Reputation: 5331
There was the Unladen Swallow project that aims to get a faster python, but it seems to be stopped :
Is there a way to get a faster python, I mean faster than C-Python, without the use of psyco ?
Upvotes: 2
Views: 342
Reputation: 2002
I agree with the previous poster. Cython is the most elegant way to make python equally compete even with C. And its all coding in python, which makes it great for those who dont know C.
IF you really want to get your hands dirty , really really dirty, there is CorePy. Corepy gives you the ability to call assembler commands from inside python. Because these are python functions , they can even be used with idle or ipython for real time extremely low level coding. That also means that there is no need to compile and because its a inlinner that means that you can mix python code with assembly code via CorePy. Extremely flexible.
Of course coding in assembly is a feat by itself , and that means that you dont need to know only Assembly but also the internals of your machine, very well. But it cant get any faster than Assembly so , if you really insane about speed give CorePy a try , it might impress you . Here is the link.
Also dont forget about ctypes, its not as fast as cython but its way faster than python and its cool that you can use any DLL with them. No need for compile at all.They also come onboard python , so there is nothing to install.
Upvotes: 3
Reputation: 31828
You could write hot code paths in Cython, Pyrex or Shedskin. That would have the positive side effect of forcing you to benchmark your code to find the hot paths in the first place, which in turn could lead to the (not implausible) revelation that Python performance may not be the actual bottleneck in your code.
Upvotes: 4
Reputation: 798626
Sure. Use one of the variants that uses a JITer, such as IronPython, Jython, or PyPy.
Upvotes: 3