wruza 37 minutes ago
It’s worth mentioning that there is a bit more overhead in using multiple processes as opposed to multiple threads, in addition to it being more difficult to share data.

There’s probably a whole generation of programmers (if not two) who don’t know the feeling of shooting yourself in the foot with multithreading. You spend a month on a prototype, then some more to hack it all together for semi-real world situations, polish the edges, etc. And then it falls flat day 1 due to unexpected races. Not a bad thing on itself, transferrable experience is always valuable. And don’t worry, this one is. Enough ecos where it’s not “difficult to share data”.

pjmlp 2 hours ago
I really find a bummer that there is such a resistance to make JIT enable versions available for download, alongside the other variants.

Naturally I can easily compile my own Python 3.13 version, no biggie.

However from my experience, this makes many people that could potentially try it out and give feedback, don't care and rather wait.

pzo 2 hours ago
not sure if there will distributed in homebrew et al but at least "Pre-built binaries marked as free-threaded can be installed as part of the official Windows and macOS installers" [0]

[0] https://docs.python.org/3.13/whatsnew/3.13.html#free-threade...

pjmlp 1 hour ago
Yes, that is my point, GIL free is available, but not wit JIT enabled.
nerdponx 2 hours ago
Hopefully Macports will decide to offer it.
sandos 58 minutes ago
So is it impossible to optimize the no-GIL case more really? 20% slower sounds like a lot really.
Ralfp 9 minutes ago
Where it says that? Its simply that Python releases features in yearly cycles and thats what was completed for release.

Idea is to let people experiment with no-GIL to see what it breaks while maintainers and outside contractors improve the performance in future versions.

pininja 4 hours ago
I remember first discussions about removing the GIL back in 2021 and a lot of initial confusion about what the implications would be. This is a great summary if, like me, you weren’t satisfied with the initial explanations given at the time.
ffsm8 1 hour ago
2021 wasn't the first discussion about that.

You can find forum and Reddit posts going back 15-20 years of people attempting to remove the GIL, Guido van Rossum just made the requirement that single core performance cannot be hurt by removing it, this made ever previous attempt fail in the end

I.e. https://www.artima.com/weblogs/viewpost.jsp?thread=214235

pansa2 1 hour ago
Did this attempt manage to preserve single-threaded performance, or was the requirement dropped?
rightbyte 1 hour ago
He folded.

The patches dropped some unrelated dead weight such that the effect is not as bad.

MrThoughtful 4 hours ago
Removing the GIL sounds like it will make typical Python programs slower and will introduce a lot of complexity?

What is the real world benefit we will get in return?

In the rare case where I need to max out more than one CPU core, I usually implement that by having the OS run multiple instances of my program and put a bit of parallelization logic into the program itself. Like in the mandelbrot example the author gives, I would simply tell each instance of the program which part of the image it will calculate.

tonygrue 4 hours ago
There is an argument that if you need in process multithreading you should use a different language. But a lot of people need to use python because everything else they’re doing is in python.

There are quite a few common cases where in process multi threading is useful. The main ones are where you have large inputs or large outputs to the work units. In process is nice because you can move the input or output state to the work units instead of having to copy it.

One very common case is almost all gui applications. Where you want to be able to do all work on background threads and just move data back and forth from the coordinating ui thread. JavaScript’s lack of support here, outside of a native language compiled into emscripten, is one reason web apps are so hard to make jankless. The copies of data across web workers or python processes are quite expensive as far as things go.

Once a week or so, I run into a high compute python scenario where the existing forms of multiprocessing fail me. Large shared inputs and or don’t want the multiprocess overhead; but GIL slows everything down.

vlovich123 3 hours ago
> Where you want to be able to do all work on background threads and just move data back and forth from the coordinating ui thread. JavaScript’s lack of support here, outside of a native language compiled into emscripten, is one reason web apps are so hard to make jankless

I thought transferring array buffers through web workers didn’t involve any copies of you actually transferred ownership:

    worker.postMessage(view.buffer, [view.buffer]);
I can understand that web workers might be more annoying to orchestrate than native threads and the like but I’m not sure that it lacks the primitives to make it possible. More likely it’s really hard to have a pauseless GC for JS (Python predominantly relies on reference counting and uses gc just to catch cycles).
Etheryte 2 hours ago
This is true, but when do you really work with array buffers in Javascript? The default choice for whatever it is that you're doing is almost always something else, save for a few edge cases, and then you're stuck trying to bend your business logic to a different data type.
vlovich123 1 hour ago
That’s a choice you get to make and probably depends on your problem domain and other things. For example when I was writing R2 it was all ArrayBuffers up and down the stack. And you could use something like capnproto or flat buffers for managing your object graph within an array buffer. But yeah, being able to transfer custom object graphs would be more powerful.
formerly_proven 30 minutes ago
There is this assumption in these discussions that anything consuming significant CPU must necessarily have a simple interface that’s easy to reduce to a C-level ABI, like calling an ML library on an image, a numpy function on two big matrices or some encryption function. Therefore it is trivial to just move these to native code with an easy, narrow interface.

This assumption is incorrect. There are plenty of problems that consist entirely of business logic manipulating large and complex object graphs. “Just rewrite the hit function in rust, bro” and “just import multiprocessing, bro” are functionally identical to rewriting most of the application for these.

The performance work of the last few years, free threading and JIT are very valuable for these. All the rest is already written in C.

lifthrasiir 2 hours ago
> Removing the GIL sounds like it will make typical Python programs slower and will introduce a lot of complexity?

This was the original reason for CPython to retain GIL for very long time, and probably true for most of that time. That's why the eventual GIL removal had to be paired with other important performance improvements like JIT, which was only implemented after some feasible paths were found and explicitly funded by a big sponsor.

simonw 4 hours ago
My hunch is that in just a few years time single core computers will be almost extinct. Removing the GIL now feels to me like good strategic preparation for the near future.
naming_the_user 3 hours ago
It depends what you mean by extinct.

I can't think of any actual computer outside of embedded that has been single core for at least a decade. The Core Duo and Athlon X2 were released almost 20 years ago now and within a few years basically everything was multicore.

(When did we get old?)

If you mean that single core workloads will be extinct, well, that's a harder sell.

simonw 3 hours ago
Yeah, I just checked and even a RaspberryPi has four cores these days. So I guess they went extinct a long time ago!
poincaredisk 18 minutes ago
Yes, but:

* Most of the programs I write are not (trivially) parallelizable, and a the bottleneck is still a single core performance

* There is more than one process at any time, especially on servers. Other cores are also busy and have their own work to do.

formerly_proven 28 minutes ago
Even many microcontrollers have multiple cores nowadays. It’s not the norm just yet, though.
im3w1l 3 hours ago
Single core computers yes. Single core containers though..
gomerspiles 3 hours ago
Single core containers are also a terrible idea. Life got much less deadlocked as soon as there were 2+ processors everywhere.

(Huh, people like hard OS design problems for marginal behavior? OSes had trouble adopting SMP but we also got to jettison a lot of deadlock discussions as soon as there was CPU 2. It only takes a few people not prioritizing 1 CPU testing at any layer to make your 1 CPU container much worse than a 2 VCPU container limited to a 1 CPU average.)

Zyten 3 hours ago
What you’re describing is basically using MPI in some way, shape or form. This works, but also can introduce a lot of complexity. If your program doesn’t need to communicate, then it’s easy. But that’s not the case for all programs. Especially once we’re talking about simulations and other applications running on HPC systems.

Sometimes it’s also easier to split work using multiple threads. Other programming languages let you do that and actually use multiple threads efficiently. In Python, the benefit was just too limited due to the GIL.

pansa2 2 hours ago
> What is the real world benefit we will get in return?

If you have many CPU cores and an embarrassingly parallel algorithm, multi-threaded Python can now approach the performance of a single-threaded compiled language.

Certhas 2 hours ago
The question really is if one couldn't make multiprocess better instead of multithreaded. I did a ton of MPI work with python ten years ago already.

What's more I am now seeing in Julia that multithreading doesn't scale to larger core counts (like 128) due to the garbage collector. I had to revert to multithreaded again.

Sakos 1 hour ago
I assume you meant you had to revert to multiprocess?
cma 4 hours ago
There will be consumer chips with 64 cores before long
v3ss0n 46 minutes ago
Experimentally JIT WHILE there is totally stable , 4-100x faster, almost 100% compatible PyPy exist and all they need is adopt it but didn't due to some politics.

Yeah right..

ksec 9 minutes ago
I don't follow Python closely. So why PyPy isn't adopted?
punnerud 2 hours ago
The ones saying they will never use Python because it’s slow, is the probability high that their “fast” language is not thread safe?
Quothling 46 minutes ago
How many teams actually decide against using Python because it's "slow"? I'll personally never really get why people prefer interpreted languages in the age of Go, but even if we go back a few years, you would just build the computation heavy parts of your Python in C. Just like you would do with your C#, your Java or whatever you use when it was required. Considering Instagram largely ran/run their back-end on Python, I'd argue that you can run whatever you want with Python.

Maybe I've just lived a sheltered life, but I've never heard speed being used as a serious argument against Python. Well, maybe on silly discussions where someone really disliked Python, but anyone who actually cares about efficiency is using C.

wongarsu 19 minutes ago
You occasionally hear stories about teams writing something in Python, then rewriting it in another language because Python turned out to be slow. I have one such story.

With the excellent Python/Rust interop there is now another great alternative to rewriting the heavy parts in C. But sometimes the performance sensitive part spans most of your program

meindnoch 1 hour ago
Python is not thread safe.
continuational 1 hour ago
Python isn't "thread safe", not even its lists are. What are you getting at?
IshKebab 2 hours ago
What do you mean by thread safe exactly? Instead of Python I would use Typescript or Rust or possibly Go.