[Numpy-discussion] Comparing NumPy/IDL Performance

Olivier Delalleau shish at keba.be
Mon Sep 26 11:52:11 EDT 2011

One minor thing is you should use xrange rather than range. Although it will
probably only make a difference for the empty loop ;)

Otherwise, from what I can see, tests where numpy is really much worse are:
- 1, 2, 3, 15, 18: Not numpy but Python related: for loops are not efficient
- 6, 10: Maybe numpy.roll is indeed not efficiently implemented
- 21: Same for this scipy function

-=- Olivier

2011/9/26 Keith Hughitt <keith.hughitt at gmail.com>

> Hi all,
> Myself and several colleagues have recently started work on a Python
> library for solar physics <http://www.sunpy.org/>, in order to provide an
> alternative to the current mainstay for solar physics<http://www.lmsal.com/solarsoft/>,
> which is written in IDL.
> One of the first steps we have taken is to create a Python port<https://github.com/sunpy/sunpy/blob/master/benchmarks/time_test3.py>of a popular benchmark for IDL (time_test3) which measures performance for a
> variety of (primarily matrix) operations. In our initial attempt, however,
> Python performs significantly poorer than IDL for several of the tests. I
> have attached a graph which shows the results for one machine: the x-axis is
> the test # being compared, and the y-axis is the time it took to complete
> the test, in milliseconds. While it is possible that this is simply due to
> limitations in Python/Numpy, I suspect that this is due at least in part to
> our lack in familiarity with NumPy and SciPy.
> So my question is, does anyone see any places where we are doing things
> very inefficiently in Python?
> In order to try and ensure a fair comparison between IDL and Python there
> are some things (e.g. the style of timing and output) which we have
> deliberately chosen to do a certain way. In other cases, however, it is
> likely that we just didn't know a better method.
> Any feedback or suggestions people have would be greatly appreciated.
> Unfortunately, due to the proprietary nature of IDL, we cannot share the
> original version of time_test3, but hopefully the comments in time_test3.py
> will be clear enough.
> Thanks!
> Keith
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110926/3bd9a444/attachment.html>

More information about the NumPy-Discussion mailing list