Pyhon 2.x or 3.x, which is faster?

Steven D'Aprano steve at pearwood.info
Wed Mar 9 21:45:03 EST 2016


On Thu, 10 Mar 2016 12:30 pm, BartC wrote:

> But the attitude in this group has been very different; Python is
> slow, but so what? Just a general shrug.

I think that sometimes people here get a bit defensive because they've
experienced too many people making snap dismissals of Python due to some
completely artificial benchmark that doesn't relate to the work that their
actually doing. These are the people who would rather spend two weeks
writing a buggy C program to do a one-off processing task that takes 10
minutes to run that we could do correctly in half a day in Python because
their code is "100 times faster".

You might think I'm exaggerating, but I've seen people do that.

Anyway, the Python community as a whole is *very* aware that Python is not
the speediest language in the world (although it is faster than Ruby,
faster than at least some Javascript implementations, and neither of those
two are suffering in popularity due to slowness). Speed is not the number 1
priority, and possibly not even the number 2 priority, but it is a priority
somewhere in the top 10. Hence there is a whole range of
performance-related factors to be considered:


- speed.python.org allows the core developers (and anyone else) to monitor
Python's performance;

- PyPy is a self-hosted[1] powerful Just-In-Time compiler aimed especially
at long-running code in loops;

- the author of Nuitka is re-writing Python in C++ with the eventual aim of
making it a highly-optimized Ahead-Of-Time compiler;

- one of the core devs, Victor Stinner, is working on FAT Python, an
optimizing implementation;

- other projects include Pyston, Pyjion, HotPy, Cython, Numba, Parakeet.


Some discussion here:

https://www.ibm.com/developerworks/community/blogs/jfp/entry/A_Comparison_Of_C_Julia_Python_Numba_Cython_Scipy_and_BLAS_on_LU_Factorization?lang=en


So don't think that the community as a whole is dismissive of speed issues.
But they're more interested in speeding up Python where it matters.





[1] Well, sort of. PyPy is actually written in RPython, a restricted subset
of Python.


-- 
Steven




More information about the Python-list mailing list