3 ms·
Here's a relevant article that convinced me how awesome Cython is: http://www.perrygeo.net/wordpress/?p=116 http://www.perrygeo.net/wordpress/?p=116 Basically
by fgimenez 16y ago
Here's a relevant article that convinced me how awesome Cython is:
http://www.perrygeo.net/wordpress/?p=116 http://www.perrygeo.net/wordpress/?p=116
Basically, if you are doing any work that requires heavy numerical processing, Cython is the way to go. On the other hand, I was playing with it to do some basic text processing and the improvements were negligible.
- xtacy 16y agoEven for numerical processing, it depends on where/how you write your loops. numpy just offers bindings to optimised C libraries and loops using map(..,..) should be much faster than using for. As far as text processing is concerned, it seems like the python code is just a nice interface to the underlying compiled library and hence there isn't much difference.
- dagw 16y agoDon't forget numpy. I managed to get his code from 2 seconds to 0.2 seconds by a simple 60 second rewrite using numpy and arrays.