[SciPy-User] Proposal for a new data analysis toolbox

Keith Goodman kwgoodman@gmail....
Thu Nov 25 10:59:18 CST 2010


On Thu, Nov 25, 2010 at 1:30 AM, Sebastian Haase <seb.haase@gmail.com> wrote:

> In [18]: timeit ds.mean(arr)
> 100000 loops, best of 3: 16.6 us per loop

To get rid of some overhead, you can call the underlying function:

>> arr = np.arange(10000, dtype=np.float64)
>> timeit ds.mean(arr)
100000 loops, best of 3: 17.7 us per loop
>> timeit ds.func.mean_1d_float64_axis0(arr)
100000 loops, best of 3: 15.1 us per loop

The overhead is more important, of course, for small arrays:

>> arr = np.arange(100, dtype=np.float64)
>> timeit ds.mean(arr)
100000 loops, best of 3: 3.25 us per loop
>> timeit ds.func.mean_1d_float64_axis0(arr)
1000000 loops, best of 3: 949 ns per loop

And can add up for min, mean, max:

>> timeit ds.min(arr); ds.mean(arr); ds.max(arr)
100000 loops, best of 3: 10 us per loop
>> min, a = ds.func.min_selector(arr, axis=0)
>> max, a = ds.func.max_selector(arr, axis=0)
>> mean, a = ds.func.mean_selector(arr, axis=0)
>> timeit min(a); mean(a); max(a)
100000 loops, best of 3: 2.65 us per loop


More information about the SciPy-User mailing list