A Wednesday 07 January 2009, Christopher Barker escrigué: [clip] > Even with this nifty JIT, I think Python has many advantages -- if > your code is well written, there will be a only a few places with > these sorts of performance bottlenecks, and weave or Cython, or SWIG, > or Ctypes, or f2py can all give you a good solution.
Agreed. Specially Cython, with the latests improvements for supporting optimized NumPy indexing: http://wiki.cython.org/tutorials/numpy would make these loops to work much faster. > One other thought -- could numexp help here? I don't think so. Numexpr is for computing expresions like 'a-b**3-c' element-wise (a, b and c are arrays) quickly. The main reason of its high performance is that it avoids temporary copies of intermediate results. In order to use it, you need to vectorize first your loops, and this is not what Nicolas wants. Cheers, -- Francesc Alted _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion