5 ms·
This is needlessly complicated. You can just use Cython and annotate the types, or, even better, use shedskin to compile your Python code, usually with no chang
by StavrosK 16y ago
This is needlessly complicated. You can just use Cython and annotate the types, or, even better, use shedskin to compile your Python code, usually with no changes, to C++ and make a module out of it.
There are many options to speed up your Python code by ~50 times effortlessly. See my blog posts:
http://www.korokithakis.net/node/109 http://www.korokithakis.net/node/109
http://www.korokithakis.net/node/117 http://www.korokithakis.net/node/117
- hugh4life 16y agoKeep an eye out for Nuitka... http://kayhayen24x7.homelinux.org/blog/2010/09/nuitka-release-0-3-1/ http://kayhayen24x7.homelinux.org/blog/2010/09/nuitka-releas...
- StavrosK 16y agoI saw that, it looks quite good but I'm not sure how much better than Unladen Swallow it can get... RPython is another promising contender, if the PyPy guys ever polish it for end users...
- hartror 16y agoThese are great when you're worried about performant code: http://docs.python.org/library/profile.html http://docs.python.org/library/profile.html http://wiki.python.org/moin/PythonSpeed/PerformanceTips http://wiki.python.org/moin/PythonSpeed/PerformanceTips
- StavrosK 16y agoYep, they won't speed your code up 50 times, though.
- hartror 16y agoI am yet to be sold on using Cython or it's ilk but it is philosophical/personal preference thing rather than a commentary on the quality or usefulness of these projects. As I have no trouble switching code to C++ and integrating it with python these projects don't offer me the same thing as a coder with less C++ experience. As an aside some simple coding changes will allow Psyco to do much of the by hand optimisations that Cython gives you. Not all and it is easy for another coder to come along and ruin everything. All it takes is some understanding of how Psyco performs its magic.
- cdavid 16y agoPsyco does not work on 64 bits, which makes it nearly useless for most servers-oriented kind of work
- samuel 16y agoI don't understand why stock Python doesn't include some sort of optional type annotation, as SBCL and other Lisps. Some years ago there was a lot of fuss in the Python community about including optional type checking in Python 3... what happened? At the end, I found most changes from version 2 cosmetic and not really exciting.
- illumen 16y agoThere are now annotations. But they are not used for anything by default.
- StavrosK 16y agoI can't either :/ It would be fantastic to be able to annotate your code a bit with types and speed it up many times. Hopefully, with Python 3, many tools (e.g. Cython) will be able to do just that.