Calculate the histograms beforehand to allow faster evaluation.