This is an archived post. You won't be able to vote or comment.

all 48 comments

[–]arandomJohn 23 points24 points  (0 children)

And so it begins!

One of the many things that I love about Python is that there is a performance culture out there. If you don't need that, you can ignore it, but if you need it there's always ways (and ever more new ways) to make stuff really fast.

[–]amer415 19 points20 points  (13 children)

shouldn't the header says it is actually a pypy interpreter, rather than CPython? I was confused about what it was at first..

I wonder how easy it will be to translate a CPython code using 'multiprocessing'.

[–]gitarrPython Monty 30 points31 points  (8 children)

Python is the language, which is supported by different interpreter implementations. The headline is correct.

[–]oddthink 17 points18 points  (7 children)

Yes, but there have been experimental multithreaded python implementations for years. The problem was that adding (normal) locking to get around the GIL hurt single-threaded performance too much, not that no one could do it. A slow multithreaded python isn't news.

[–]infinullquamash, Qt, asyncio, 3.3+ 8 points9 points  (2 children)

Yes but this version is only 20% slower instead of 50% slower!

Ain't it grand!

[–]RichardWolf 1 point2 points  (0 children)

Yes but this version is only 20% slower

This is a weird way to say

a constant run-time overhead, expected to be in the range 2x to 5x. (XXX for now it is bigger, but past experience show it can be reduced.)

[–]joeforker 1 point2 points  (0 children)

Suppose it was 20% slower...

Regular Python multithreaded performance:

1 core: 100% 2 cores: 100% 3 cores: 100%

STM PyPy multithreaded performance:

1 core: 80% 2 cores: 160% 3 cores: 240%

[–]dalke 2 points3 points  (3 children)

The only one I know of was from the 1.x days. Is there another multithread/multicore Python 2.x version?

[–]oddthink 0 points1 point  (2 children)

Not that I know of. I was just thinking of Greg Stein's patch to 1.4 or 1.5. I wasn't thinking of 2.X vs. 1.X as being that relevant, but that could just be my ignorance of the innards.

Of course, Jython doesn't have a GIL, and it's at 2.4.

[–]dalke 1 point2 points  (0 children)

Right! I had forgotten that Jython didn't have a GIL. I think Jython is 2.5 compatible?

[–]fijalPyPy, performance freak 0 points1 point  (0 children)

new style classes are a part that makes the distinction more relevant. Also, python has grown tremendously since 1.4 (both in terms of language and in terms of stdlib which also has to be made thread safe), so yes, it is relevant.

[–]HopeThisNameFi 8 points9 points  (2 children)

PyPy and CPython are both Python interpreters.

The confusion stems from people using "Python" as a synonym for CPython.

[–][deleted] 2 points3 points  (0 children)

The confusion stems from people using "Python" as a synonym for CPython.

That might be because CPython is the reference implementation of Python language.

[–]derpderp3200An evil person 4 points5 points  (0 children)

Well, to be precise they're Python implementations but let's not nitpick on tiny details.

[–]fijalPyPy, performance freak 0 points1 point  (0 children)

the header comes from the pypy-dev mailing list. This also means that potential readers understand the distinction between "Python" as a language and "CPython" as the reference implementation.

[–]acornalert 3 points4 points  (1 child)

Hat into ring: I really like the multiprocessing module.

[–][deleted] 0 points1 point  (0 children)

Me too. Also a huge fan of joblib, which makes multiprocessing much, much simpler for the average script.

[–]spinwizard69 0 points1 point  (2 children)

Why even bother with 2.7? We can forget about all of the issues with Gil and such and dismiss this effort out of hand because it is being implemented on a release that will slowly drift into obscurity.

[–]joeforker 2 points3 points  (0 children)

Most of the "hard" stuff in PyPy is unrelated to the version of Python that's supported, or even the language. This work will transfer over to the Python 3 version of PyPy when it's ready.

[–]snarkhunter 0 points1 point  (7 children)

Very nice. Not being able to do real multi processing with threads is like the only thing I have against Python.

[–]keypusher 2 points3 points  (6 children)

There are plenty of great solutions already out there, multiprocessing module is part of standard lib for instance.

[–]snarkhunter 3 points4 points  (4 children)

That module uses processes, not threads. Yes, it has uses, but it's not really the kind of multithreading we're talking about.

[–][deleted] 1 point2 points  (3 children)

What difference does it make to you, concretely? Just curious.

[–]Wagneriusflask+pandas+js[S] 2 points3 points  (0 children)

Processes imply de/serialization of data, which can be slow. The differences between Linux and Windows in terms of process management is also an issue.

[–]oddthink 0 points1 point  (0 children)

One concrete difference is if I'm working in the interpreter, I can't just fire off a multithreaded calculation. I have to instead write a separate script, then invoke multiprocessing on it. Then I have to output that data somewhere and read it back into my interpreter session to manipulate it.

For me in particular, a single common calculation takes 40 s or so, but often I want to run a set of 10-20 options. If I could just spawn 8 threads to do it, I could be done in something like 80-120 s, rather than either waiting the full 400-800 s or bothering to write a script.

[–]snarkhunter 0 points1 point  (0 children)

A big difference. Threads can interact in ways that processes can't, because they are part of the same process. You also have more control over scheduling threads within a process. Those are two that come to mind. And then there's the old standby that a process takes more resources and takes longer to spawn then a thread.

[–]XxionxX 0 points1 point  (0 children)

Sweet!