Thursday 19 October 2017

python - Why shouldn't I use PyPy over CPython if PyPy is 6.3 times faster?

itemprop="text">

I've been hearing a lot about the
PyPy
project. They claim it is 6.3 times faster than the href="http://en.wikipedia.org/wiki/CPython" rel="noreferrer">CPython
interpreter on their
site
.



Whenever we talk about dynamic
languages like Python, speed is one of the top issues. To solve this, they say PyPy is
6.3 times faster.




The second issue is
parallelism, the infamous href="http://en.wikipedia.org/wiki/Global_Interpreter_Lock" rel="noreferrer">Global
Interpreter Lock (GIL). For this, PyPy says it href="http://pypy.org/tmdonate.html" rel="noreferrer">can give GIL-less
Python.



If PyPy can solve these great
challenges, what are its weaknesses that are preventing wider adoption? That is to say,
what's preventing someone like me, a typical Python developer, from switching to PyPy
right now?


class="post-text" itemprop="text">
class="normal">Answer





  1. PyPy, as others have
    been quick to mention, has tenuous support for C
    extensions
    . It has support, but typically at
    slower-than-Python speeds and it's iffy at best. Hence a lot of modules simply
    require CPython. Cython and Numpy are awesome
    for numerics, and most people who actually need speed in Python are using those (+
    Pandas, SciPy, etc.) heavily. Since they're either non-existent or tenuously supported
    and slow the people who need a fast Python often are better off with
    CPython both for speed and
    ease-of-use
    .

  2. Python 3 support
    is experimental at the moment. has just
    reached stable! As of 20th June 2014, href="http://morepypy.blogspot.co.uk/2014/06/pypy3-231-fulcrum.html"
    rel="noreferrer">PyPy3 2.3.1 - Fulcrum is
    out!

  3. PyPy sometimes
    isn't actually faster for "scripts", which a lot of people use
    Python for. These are the short-running programs that do something simple and small.
    Because PyPy is a JIT compiler its main advantages come from long run times and simple
    types (such as numbers). Frankly, PyPy's pre-JIT speeds are pretty
    bad
    compared to
    CPython.

  4. Inertia. Moving to
    PyPy often requires retooling, which for some people and organizations is simply too
    much
    work.




Those
are the main reasons that affect me, I'd
say.





NOTE: This question is ancient! Avoid drawing
conclusions from out-of-date
information.




No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...