Types, Cython, program readability
stefan_ml at behnel.de
Sun Mar 16 15:57:16 CET 2008
bearophileHUGS at lycos.com wrote:
> It seems Cython is going to become an efficient and
> general purpose language after all, with optional static typing (its
> purpose: mostly for speed), and it may even gain some kind of macros
> soon. So it may even end replacing Python itself in some situations
> where running efficiency is important, and where Psyco can't be used
> or isn't enough.
Even without any static type annotations, Cython currently runs the supported
portion of pybench some 30% faster than CPython 2.5.1, with for-loops and
if-then-else being multiple times faster. Even on plain Python numbers,
arithmetic gives you a factor of 2 in Cython.
If you need more, C arithmetic and integer loops can easily be enabled with
type annotations, and the Cython project is working on further optimisations
for normal Python code. So if speed is important and the existing code is
supported by Cython (or can be made working), compilation is definitely an option.
More information about the Python-list