ENH: Speed up _histogram and _histogram_indices.