Talk Python To Me
#570: Free-Threaded Python

Episode 570 · Season 1

#570: Free-Threaded Python

Talk Python To Me

1:01:49

About this episode

NumPy already releases the GIL. So threads should already pay off for your NumPy code, right? Christopher Ariza tested that. He summed the rows of a 10,000 by 10,000 array on Python 3.14. Sequential took 360 milliseconds. A thread pool took 373, slower than doing nothing. The same code on free- threaded Python 3.14t took 83.7 milliseconds. Free-threaded Python is officially supported as of 3.14. The GIL isn’t gone, though. It’s a zombie. Import one compiled package that hasn’t opted in, psycopg2 for example, and the GIL comes back for your entire process. You get a warning, not an error. Chris is the creator of StaticFrame and its C extension library ArrayKit. We dig into when threads beat plain NumPy, how to tell if you’re actually running free-threaded, and conditional-futures, his drop-in thread pool that stops your code from getting slower when the GIL wakes back up.

More from Talk Python To Me

Where does your Python code actually run? A server in Virginia? A container in Frankfurt? Pyodide put Python into the browser. Cloudflare put the browser into the server. Combine the two and you get P…

1h 2m

The most popular Python project you've probably never heard of has 252,000 GitHub stars and merged over 1,800 pull requests in a single week. It's Hermes, a self-hosted AI agent you program just by ta…

1h 6m

Which of your Python tools would you still pick if you started fresh today? For a long time, the answer was easy. The stack felt settled. AI has reopened almost every one of those choices. Some tools…

1h 5m