6 ms·
If said intensive math is currently written in Python, then rewriting it in CorePy will likely give a big speed boost. CPython does not compile down to machine
by CUViper 18y ago
If said intensive math is currently written in Python, then rewriting it in CorePy will likely give a big speed boost. CPython does not compile down to machine code, so it can't do the optimizations that a full compiler can do.
Now, if a project like this made it easier to embed C or C++, you might get the best of both worlds...
- albertcardona 18y agoEmbedding C or C++ into python is no big deal with scipy.weave and gcc. Just try it: http://albert.rierol.net/doodle_programming.html#1 http://albert.rierol.net/doodle_programming.html#1
- CUViper 18y agoThanks -- scipy.weave looks to do the trick! BTW, while that linked code is a good example of how weave works, it's a bad example of when to use it. I've no doubt that the code runs faster with that portion written in C, but a different algorithm could blow it away. A prime generator like that would be MUCH faster with a sieve, even in pure Python.
- albertcardona 18y agoThat code was proof of principle, just playing. No claim to have written any particularly efficient prime number generator. I'm glad you found it instructive.
- njharman 18y agoSeveral projects like that... http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/version/Doc/About.html http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/ver... http://sourceforge.net/projects/cxx/ http://sourceforge.net/projects/cxx/ http://www.boost.org/doc/libs/1_37_0/libs/python/doc/index.html http://www.boost.org/doc/libs/1_37_0/libs/python/doc/index.h... swig for completeness but I don't think it qualifies for easier or just let the jit do it http://psyco.sourceforge.net/introduction.html http://psyco.sourceforge.net/introduction.html
- CUViper 18y agoThose are all nice frameworks for building extensions, but requiring an external build step is a bit cumbersome. Ultimately though, I agree that a JIT is the way to go.