[Numpy-discussion] Is there a more efficient way to do this?
gandalf at shopzeus.com
Wed Aug 8 16:46:15 EDT 2012
> In : timeit get_slices_slow(data)
> 100 loops, best of 3: 3.51 ms per loop
> In : timeit get_slices_fast(data)
> 1000 loops, best of 3: 1.76 ms per loop
> In : timeit get_slices_faster(data)
> 10000 loops, best of 3: 116 us per loop
> So using the fast bincount and array indexing methods gets you about a
> factor of 30 improvement. Even just doing the counting in a loop with
> good indexing will get you a factor of 2.
Fantastic, thank you! I do no fully understand your code yet. But I'm
going to read all related docs. :-)
More information about the NumPy-Discussion