Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

I think in general, programs written in "Python" will perform better in PyPy then CPython, but the current submissions are hyper-optimised for the implementation details of CPython.


sort by: page size:

PyPy in general has much better performance than CPython.

Almost all Python code is written for CPython, and if you run into performance issues you tweak it until it runs on pypy.

I'm glad that pypy exists because it forces cpython to do something about performance, but for python overall it's a pretty niche tool.


For algorithmic code PyPy can provide substantial speedups over CPython. I've used PyPy in code fingerprinting large bioinformatics files and seen big speedups. I've also tried porting a webapp processing JSON from CPython and seen no perceptible speedup.

I think using Pypy instead of CPython will give you several times the performance boost as any of this.

FWIW PyPy is signfificantly faster than CPython in a lot of tasks.

Actually, my experience with PyPy, while generally positive, has exhibited many of the characteristics that article talks about in terms of downsides to "sufficiently-smart compilers." It's almost always much faster than cpython, but how much faster is highly variable, and not especially predictably so; seemingly-insignificant changes can have large and unexpected performance implications, and it's difficult as a developer to have the proper mental model to figure out what's actually going on.

In CPython land, Python is slower, but performs predictably, and if you want to speed it up you write C, which is much faster, and also performs predictably, though it takes some developer effort. In PyPy, you get some of the speed of C without the effort, but without the predictability either.


[citation needed] You're mostly talking nonsense. PyPy is usually 20-100x faster on the numeric workloads I measured than CPython, while the difference is significantly smaller on non-numeric workloads. The difference between C++ and CPython is also smaller.

Why do competitive Python programmers use PyPy instead of CPython?

Pypy is considerably faster than CPython, so I don't think Python is doomed to be slower?

PyPy is much faster than CPython.

I don't know much about the other ones, but I think you'd have to say PyPy has been a success. Although to be honest, I don't know why it would be better to modify CPython vs. just using PyPy -- the JIT speedup does come with some tradeoffs (memory usage, warmup times), so it seems better just to leave that decision up to the user?

After I ran the experimental evaluation, I had similar thoughts. If PyPy ever matches the current version of CPython I'm not sure why one wouldn't use PyPy over CPython. The biggest hurdle is matching support for popular libraries like NumPy, Tensorflow, Pandas, Scipy etc. I know they're working on supporting these, it's definitely a lot of work to do, easier said than done.

If you need better performance you'd be looking at PyPy instead of CPython. If Python 3 runs faster on PyPy as well that could make a difference.

how does it compare (performance wise) to cpython and pypy implementations ?

PyPy was never able to get fast enough to replace CPython in spite of its lack of compatible C API. CPython is trying to move fast without breaking C API, and 2--9% improvement is in fact very encouraging for that and other reasons (see my other comment).

Performance isn't a quality that is either present or not present, it's a quantity you can measure with a number as you did. It's true that pypy is much faster than CPython, but it's also true that C++ is much faster than pypy. Cpython is normally about 2 orders of magnitude slower than C++ on computationally intensive workloads, and if pypy get that down to a single order of magnitude that's great... but not enough here.

The major issue with PyPy is that it has a radically different C API than CPython, leading to incompatibility with NumPy, Pandas, etc. to mention just a few prominent performance-critical Python packages that are written in C. PyPy works if you want to use pure Python code, but that's rarely the case in real-world high-performance Python projects.

They compare PyPy and CPython in their benchmarks.

Pypy isnt used that much because you may run into problems. And nobody wants to research strange runtime errors in production.

But the speed improvements would be welcome if they were in cpython because you can be quite sure there will be no problems.

next

Legal | privacy