PERF: lib.generate_slices
```
import numpy as np
import pandas._libs.lib as lib

np.random.seed(0)
inds = np.random.randint(0, 100, 1000000)
ngroups = inds.max() + 1

%timeit lib.generate_slices(inds, ngroups)
```
Master:
`1.86 ms ± 44 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)`

This pr:
`859 µs ± 127 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)`

Adding the `cython` decorators makes a huge difference here

@meeseeksdev backport 1.3.x thanks @mzeitlin11  Something went wrong ... Please have  a look at my logs.