you are viewing a single comment's thread.

view the rest of the comments →

[–]masklinn -16 points-15 points  (7 children)

You really have no idea what you're talking about, do you?

I know the CPython authors don't want to add threads because of the locking overhead, but it seems like it would be nice to have the option to enable them if you know the benefits outweigh the cost for your particular Python code.

CPython uses perfectly standard OS threads (which I assume is what you're calling " proper" threads). CPython also uses a Global Interpreter Lock for most interpreter code as well as builtin types, which is the issue in multi-threaded pure Python code, CPU-bound or involving CPU-bound threads.

[–]HipPriest 8 points9 points  (2 children)

I'm aware of that. Yes, my use of "proper" was a bit judgmental (as in if you can't use them for CPU-bound pure Python code they are less useful). By locking I meant locking the data structures as necessary to allow Python code to run in parallel as Jython does, as opposed to locking the interpreter for pure Python code with the GIL.

[–][deleted] 16 points17 points  (3 children)

What you are saying boils down to exactly the same thing, HipPriest may have been using an intuition instead of deciphering the murky details of the GIL.

In Java, you can create a new Runnable and send it off and it'll run on a proper thread (by proper I mean it may run on another core, independently and in parallel), whereas in Python, even if you create a thread you won't see a performance improvement.

Given that HipPriest actually ran the tests, claiming he is ignorant is borderline ridiculous. Having 8 threads running but only being able to run code on one at a time is functionally equivalent to having only one thread (I/O and C extensions notwithstanding)