Hi,
Pyrex saved my life!... Here is my little story, in case it interests
you... We had to start a new project and I suggested to use open
source software instead of the commercial packages we often use. I
proposed to use python but I had to prove that it could do the job
without taking more computer time.
Python was a completely new language to me but in one week I was able
to code something that was 10 times cleaner and easier to maintain
(thanks to defining special classes and overloading arithmetic
operations). But thousand iterations would take 88 seconds in python
while in the commercial package they took 1.8... The code had about
thousand lines but all the time was taken in a 5 line loop. Optimising
the data structure I got 23 seconds. Then I decided to use numpy and
matrix multiplication to do the job, but I couldn't get anything
better than 10 seconds. I had only one day to improve the algorithm
and I knew that anything running slower than the 1.8 seconds of the
commercial application would be rejected by my superiors. I had to
present my results last Friday, on the morning. Late on Thursday
morning I found the page
http://www.scipy.org/PerformancePython
which pointed to several different possibilities. After some
hesitation (I knew that I had time for only one try) I chose pyrex,
since it seemed me to be the safest choice in terms of freedom. It
took me some time to install pyrex, to get a C compiler and to make an
initail test under cygwin (I have to use a windows machine in my
work), but at 15h I was able to run the code of the page and reproduce
the .c file out of the .pyx. I started then coding my special purpose
sparse matrix multiplication (not very long algorithm but a little bit
tricky) and ended it on 4 am. The next day I came with the time of 0.9
seconds, twice as fast as the commercial package!...
Pyrex is an extremely beautiful idea and it was enormously useful for
me. It was a pleasure to get my code to run and to have all the
flexibility of C so nicely integrated with python. I suggest that you
put a link on the pyrex page to the one I mentionned. For people doing
numerical computation the interface showed in the example with numpy
structures is very helpful.
Thanks a lot and best wishes!
Marko Loparic