[Numpy-discussion] odd performance of sum?

eat e.antero.tammi@gmail....
Thu Feb 10 09:29:23 CST 2011


Hi,

Observing following performance:
In []: m= 1e5
In []: n= 1e2
In []: o= ones(n)
In []: M= randn(m, n)
In []: timeit M.sum(1)
10 loops, best of 3: 38.3 ms per loop
In []: timeit dot(M, o)
10 loops, best of 3: 21.1 ms per loop

In []: m= 1e2
In []: n= 1e5
In []: o= ones(n)
In []: M= randn(m, n)
In []: timeit M.sum(1)
100 loops, best of 3: 18.3 ms per loop
In []: timeit dot(M, o)
10 loops, best of 3: 21.2 ms per loop

One would expect sum to outperform dot with a clear marginal. Does there
exixts any 'tricks' to increase the performance of sum?

In []: sys.version
Out[]: '2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit
(Intel)]'
# installed binaries from http://python.org/
In []: np.version.version
Out[]: '1.5.1'
 # installed binaries from http://scipy.org/


Regards,
eat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110210/eb1e3624/attachment.html 


More information about the NumPy-Discussion mailing list