Alright, probably my timing is due to my test case being a virtual array?

```
# github version
In [1]: import sklearn.preprocessing

In [2]: import numpy as np

In [3]: a = np.arange(1000000)

In [4]: b = np.random.random_integers(0, 9, size=1000000)

In [5]: %time _ = sklearn.preprocessing._collect_indices(a)
CPU times: user 1.07 s, sys: 0.11 s, total: 1.18 s
Wall time: 1.11 s

In [6]: %time _ = sklearn.preprocessing._collect_indices(b)
CPU times: user 0.33 s, sys: 0.05 s, total: 0.38 s
Wall time: 0.32 s


# labels, indices = zip(*sorted(iteritems(d)))
In [1]: import sklearn.preprocessing

In [2]: import numpy as np

In [3]: a = np.arange(1000000)

In [4]: b = np.random.random_integers(0, 9, size=1000000)

In [5]: %time _ = sklearn.preprocessing._collect_indices(a)
CPU times: user 2.31 s, sys: 0.18 s, total: 2.49 s
Wall time: 2.46 s

In [6]: %time _ = sklearn.preprocessing._collect_indices(b)
CPU times: user 0.36 s, sys: 0.05 s, total: 0.42 s
Wall time: 0.35 s
```