Back-ported Kyle's speedup of mixing statistics.