Steffen Loeck wrote: > Hi all, > > i made some speed tests using the sin-function and the %-operation to compare > Numeric, numpy 0.9.8 and numpy 0.9.9.2732. > As result the latest numpy version seems to be very slow in comparison to the > two other candidates. > > Results (in usec per loop): > sin-array mod-array > > Numeric 134 18 > > numpy 0.9.8 97 55 > > numpy 0.9.9.2732 204 316 > > numpy 0.9.8 + math 38 > > numpy 0.9.9.2732 + math 161 > > Numeric + math 23 > > > The used scripts can be found at the end. > > Can anyone verify my results and explain the observed speed degression? >
I can't verify the results, but it's possible that the indexing code for a single integer is a bit slower. However, you forgot to test the "use Python lists" approach which is the fastest of all on this code. python -m timeit -s "x = [0.1]*10;" "for i in xrange(9): x[i+1]=(x[i]+1.1)%(1.0)" Using Numeric/NumPy is always slower than lists if you are doing element-by-element processing. NumPy is slower than Numeric for such processing. But, Numeric was always slower than pure Python too for such processing. So, the moral of the story is: "don't compute like that with NumPy (or Numeric)" With that said. I can add back the 1-d integer check in the indexing code to see if that speeds things up... -Travis Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion