making histograms fast