469,950 Members | 2,067 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

Speed comparison of Numeric, numarray, numpy

just a note - some speed comparisons :
>>timeit.Timer('x=a-a*.1','import Numeric;a=Numeric.ones(300,Numeric.Float)').timeit (10000)
0.60627370238398726
>>timeit.Timer('x=a-a*.1','import numarray;a=numarray.ones(300,numarray.Float)').tim eit(10000)
0.42836673376223189
>>timeit.Timer('x=a-a*.1','import numpy;a=numpy.ones(300,numpy.float)').timeit(10000 )
0.36965815487747022
>>timeit.Timer('x=a[30:40]','import Numeric;a=Numeric.ones(300,Numeric.Float)').timeit (10000)
0.016557970357098384
>>timeit.Timer('x=a[30:40]','import numarray;a=numarray.ones(300,numarray.Float)').tim eit(10000)
0.15692469294117473
>>timeit.Timer('x=a[30:40]','import numpy;a=numpy.ones(300,numpy.float)').timeit(10000 )
0.01951756438393204
>>timeit.Timer('x=MLab.max(a)','import Numeric,MLab;a=Numeric.ones(300,Numeric.Float)').t imeit(10000)
0.21454933518180042
>>timeit.Timer('x=a.max()','import numarray;a=numarray.ones(300,numarray.Float)').tim eit(10000)
0.70624786110965942
>>timeit.Timer('x=a.max()','import numpy;a=numpy.ones(300,numpy.float)').timeit(10000 )
0.21168165227754798
>>timeit.Timer('x=MLab.max(a[30:40])','import Numeric,MLab;a=Numeric.ones(300,Numeric.Float)').t imeit(10000)
0.21775784352394112
>>timeit.Timer('x=a[30:40].max()','import numarray;a=numarray.ones(300,numarray.Float)').tim eit(10000)
0.81516337970242603
>>timeit.Timer('x=a[30:40].max()','import numpy;a=numpy.ones(300,numpy.float)').timeit(10000 )
0.21344193186450866
>>timeit.Timer('a*=0.99','import Numeric;a=Numeric.ones(300,Numeric.Float)').timeit (10000)
0.293094513410324
>>timeit.Timer('a*=0.99','import numarray;a=numarray.ones(300,numarray.Float)').tim eit(10000)
0.061937480881169904
>>timeit.Timer('a*=0.99','import numpy;a=numpy.ones(300,numpy.float)').timeit(10000 )
0.16990958347923879
strange differences in all directions ...

robert
Oct 22 '06 #1
0 1793

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by myang | last post: by
11 posts views Thread by grv | last post: by
10 posts views Thread by Bryan | last post: by
12 posts views Thread by mart.franklin | last post: by
5 posts views Thread by auditory | last post: by
4 posts views Thread by Christian Convey | last post: by
5 posts views Thread by Erik Johnson | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.