Merge AC matching speedup into master.