Histogram generation accesses a map billions of times per query. Switching to a slice should significantly speed this up.