FIX: _histogram is slow as, use np.bincount instead.
Make _collect_indices return two arrays.