DEV Community

TildAlice
TildAlice

Posted on • Originally published at tildalice.io

Python GIL vs Free-Threading: 3.13t CPU Benchmark

The GIL Finally Dies (Sort Of)

Python 3.13t ships with experimental free-threading builds that disable the Global Interpreter Lock. After three decades of "just use multiprocessing," you can now spawn actual parallel threads for CPU-bound work.

But does it actually work?

I ran the same CPU-intensive benchmark on Python 3.12 (GIL-locked) and 3.13t (free-threaded) to see if real parallelism delivers the speedups we've been promised. Spoiler: it does, but not everywhere, and the overhead is real.

A laptop screen showing a code editor with visible programming code in a dimly lit environment.

Photo by Daniil Komov on Pexels

What the GIL Actually Does

The Global Interpreter Lock is a mutex that protects access to Python objects. Only one thread can execute Python bytecode at a time, even on a 64-core machine. This makes CPython's memory management simple (no concurrent reference counting nightmares), but it also means threading is useless for CPU-bound tasks.


Continue reading the full article on TildAlice

Top comments (0)