Histogram calculation speedup.