Free-threaded Python and NumPy. When CPU-bound threads pay off without the GIL. Bold white title on a dark blueprint grid with thin blue construction lines.

Free-Threaded Python and NumPy, a Visual Guide

TL;DR: Free-threaded Python (the 3.14t build) runs Python threads on several cores at once, and it's officially supported as of Python 3.14. Even NumPy code, which already releases the GIL, can run several times faster with threads when each row of work creates Python objects. The catch: one compiled package that hasn't opted in quietly turns the GIL back on for the whole process, so you have to check that it stays off.

For most of Python's life, threads were for waiting. Download a pile of files, call a few APIs, and threads help because the GIL is released while you sit on the network. Ask those same threads to crunch numbers and they line up behind the global interpreter lock and take turns. CPU-bound parallel work meant multiprocessing, a C extension, Rust or a GPU.

Free-threaded Python changes that. It's a separate build of CPython with the GIL disabled, so a ThreadPoolExecutor can keep eight cores busy on pure Python work. For a long time the word on it was "slower", and early on that was true. By Python 3.14 the slowdown had largely been worked out, the standard library had been made thread-safe, and the build moved from experimental to supported.

But NumPy already drops the GIL for its heavy lifting. Does free threading buy anything there? Christopher Ariza, creator of the StaticFrame DataFrame library, set out to measure exactly that for his PyBay 2026 talk. The answer depends on the shape of your data and on how much Python happens between NumPy calls, and sometimes it's an order of magnitude.

This guide follows that thread from the bottom up: why the GIL existed, where free threading stands today, how to install it and confirm you're actually running it, what the benchmarks show for tall, square and wide arrays, and the traps. Those include the GIL coming back from the dead, a dependency tree that isn't ready, and code that passes CI while hiding a race. It closes with a small library that picks threads or serial execution for you, and a note on getting AI agents to write parallel code at all.

Listen to the full episode

Why Python had a GIL: reference counting and immortal objects

Threaded architecture: GIL optimizations. Comparing GIL bottlenecks to immortal objects bypassing reference counting. Left, a funnel labelled "The GIL kept reference counts safe" and "Earlier attempts slowed single-threaded Python". Right, open lanes labelled "Immortal objects such as None skip counting".

Why did Python need a global interpreter lock at all? Mostly because of reference counting. Every value in CPython is a PyObject on the heap, and each one carries a count of how many references point at it. When the count drops to zero, the memory is freed. That's how Python gets its predictable cleanup and much of its dynamic behavior.

The cost is that almost everything touches a count. Write x = 700 and the integer object's count goes up. Write y = x and it goes up again. Pass it to a function, put it in a list, pull it back out: more increments and decrements. People say Python has no pointers, but it's really all pointers, and every one of them is counted. If two threads bump the same count at the same moment without coordination, the number comes out wrong and an object gets freed while it's still in use. The GIL made those updates safe by letting only one thread run Python bytecode at a time.

Removing it has been something of a white whale for the core developers. Larry Hastings spent years on his Gilectomy and reported progress at conferences. The recurring problem was that making reference counts thread-safe made ordinary single-threaded Python much slower. Four threads might buy you twice the speed, but only because each one started from a slower baseline. The core team's position was reasonable: a change that slows down the most common case, single-threaded code, doesn't go in. Sam Gross's work at Meta, which became PEP 703, finally cracked it around the Python 3.12 timeframe.

The fix came in several layers. One of them is immortal objects. None, True, False and the small integers from -5 through 256 are allocated once and live for the whole process, so CPython doesn't need to track their counts at all. Small integers already used a flyweight pattern: the literal 7 always points at the same pre-built object, which only works because integers are immutable. Making objects like these immortal means the hottest objects in any program never touch a counter.

Anyone who has written a C extension knows how big a deal this is. A huge share of extension code is reference count bookkeeping, down to the surprise of having to increment the count of None. With immortality, that's no longer necessary.

Objects that never change and never die are also the easiest ones to share between threads, an idea that comes back later in this guide.

“Reference counting is obviously so important to how Python works and how it gets its excellent dynamic behavior.”

Christopher Ariza

Is free-threaded Python ready? From PEP 703 to Python 3.14

Conditional in 3.13 under PEP 703. A grey chip feeds a glowing blue chip labelled "Supported in 3.14, standard library made thread-safe", which fans out into a circuit board labelled "What is left is the ecosystem", with tags for thread-safe modules, optimized pathways and parallel computing.

The way free threading arrived in Python was unusual. PEP 703 was accepted conditionally. Python 3.13 shipped the free-threaded build as an experiment, with the core developers keeping the right to pull it back out if it didn't work. Features don't normally land that way, and it's part of why many developers still think of free threading as a science project.

It isn't anymore. In Python 3.14 the free-threaded build became officially supported. Much of the work in between went into the parts you'd take for granted. The first attempts years ago slowed the standard library down so much that people doubted the whole idea would work. Since then, the core team has handled the reference counting problem and also gone through the built-in containers and standard library modules so they're both thread-safe and fast with several threads running. You can use a dict or a list from multiple threads without the interpreter falling over.

So what's left? Mostly the packages you install. The runtime is largely done, and the remaining work is in the ecosystem. Every compiled extension module has to be rebuilt for the free-threaded build and has to declare that it's safe to run without the GIL. Pure Python packages load fine as they are, though loading isn't the same as being thread-safe. That split, compiled versus pure Python, decides most of what goes right or wrong when you try free threading on a real project, and the next few sections dig into it.

There's still one oddity to keep in mind. Free threading isn't a switch you flip in normal Python. It's a second interpreter binary you install next to the regular one, which is the subject of the next section.

“Honestly, it's an ecosystem challenge, not a Python runtime challenge now.”

Michael Kennedy

How to install free-threaded Python with uv (and the missing t)

Requires a separate binary, installed with uv, usually with a t suffix such as 3.14t. Arrows lead to a box where "3.14" sits beside a dissolving "t", captioned "A virtual environment drops the t", above a dashed line marked "System boundary".

Free-threaded Python isn't a module you import or a flag on your usual interpreter. It's a separate CPython binary, built with the GIL disabled, that lives beside the regular one. That's probably the biggest reason most Python developers haven't tried it yet: you have to go get a different Python.

The convention is a t suffix on the version: python3.14t, and now python3.15t. With uv, that's one command:

uv python install 3.14t
uv venv --python 3.14t
.venv/bin/python -VV

The last line prints something like Python 3.14.10 free-threading build (...). Plain --version just says Python 3.14.10, the same as the regular build, so use -VV when you need to know which one you have.

Here's where it gets confusing. Once you create a virtual environment from a free-threaded Python, or compile CPython yourself with free threading turned on, the python inside isn't necessarily called anything with a t. The virtual environment above has python, python3 and python3.14 alongside python3.14t, and all of them are the free-threaded interpreter. Look at a terminal and you can't tell which build you're on from the command name. That's a recipe for benchmarking the wrong thing and wondering why threads didn't help.

The naming is just as messy around the edges. uv lists it as cpython-3.14+freethreaded. Some packages call it free threading, Ubuntu's apt packages call it no-GIL, and others just say 3.14t. They're all the same thing.

Is it sustainable to have two Pythons forever? Probably not, and it may not have to be. The expectation is that the split goes away and the free-threaded build eventually becomes the only CPython. Until then, a cheap habit pays for itself: print the build at the start of any benchmark or job that depends on it, and check at runtime that the GIL is actually off. That second check matters more than you'd think, for reasons covered further down.

“My strong belief is that this is all going to go away. And eventually, free-threaded Python is just going to be Python.”

Christopher Ariza

StaticFrame's row-wise apply: twice as fast with no code changes

A long steel bar labelled "Baseline execution time" with a callout "NumPy already releases the GIL", above a glowing blue bar about half its length with the callout "StaticFrame's row-wise apply ran in half the time or less with no code changes".

The first real test of free threading here was a DataFrame library. StaticFrame is an immutable, statically typeable alternative to pandas, and its row and column apply methods could already fan work out across threads or processes through concurrent.futures. The option had been there for years. Under the GIL, though, threads rarely helped unless almost all of the work happened inside C code that released the lock.

So what happens when you run that same code on python3.14t? The expectation was that something would need to change. Nothing did. The same standard library thread pool, the same StaticFrame code, and a row-wise apply finished in half the time or less, straight out of the box.

Why did it work so well? A DataFrame apply runs a Python function on every row. That function creates Python objects, calls methods and returns values, so a lot of the time is spent in the interpreter, exactly where the GIL used to serialize everything. Free threading speeds up exactly that kind of work.

That raises a harder question. NumPy is already about as fast as Python gets. It does its loops in C, uses SIMD instructions, and releases the GIL while it works. Could threads possibly beat it on something as simple as summing rows?

For some shapes of two-dimensional array, yes. Not for every shape, and not by much for the simplest operations, but enough to be surprising. The next two sections go through the measurements.

The general rule holds up across all of them: if each thread doesn't get enough work, the overhead of handing out tasks and gathering results eats the gain. For most real code, the bar is lower than you'd guess. As soon as each row does a little more than one fast NumPy call, threads start paying for themselves.

“I just started it with free threaded Python and everything just worked and everything was just faster.”

Christopher Ariza

NumPy with threads: why array shape decides the result

On 100 million elements. Tall, square and wide array outlines each send arrows past a line marked "with the GIL" to a warning box, "threads hurt every shape". Below a line marked "without it", the paths read "terminated", "no improvement", and "only wide arrays improved, to about two thirds with eight threads".

Most DataFrame benchmarks run on one arbitrary table and declare a winner. That hides a lot. The same operation can be fast on a tall table and slow on a wide one, and the column types (floats, integers, strings) can swing it again. So the benchmarks behind this guide vary the shape on purpose, using two-dimensional NumPy arrays of about 100 million integers in three shapes:

  • Tall: many short rows. Lots of tasks, each one tiny.
  • Square: rows and columns about equal.
  • Wide: few long rows. Fewer tasks, each one doing more work.

The operation is a row-wise function application, which comes up constantly in financial modeling and elsewhere. Each column is a characteristic, and you run a function over every row to derive a new value. The first test is the simplest possible function: call .sum() on each row, and spread the rows across a thread pool, comparing python3.14 against python3.14t.

With the GIL, every thread count is worse than doing it sequentially, for every shape. No surprise there, even though NumPy releases the GIL inside sum(). The Python-level work of handing out rows and collecting results is still serialized, and it adds up.

Without the GIL, tall and square arrays still got slower with threads. Each row sum is over so fast that the cost of scheduling it dominates. The wide array is the exception. Its rows are long enough that each task does real work, and with around eight threads the run time dropped to about two thirds of the sequential time.

Two thirds isn't dramatic. But think about what's being beaten: a single built-in NumPy reduction that's already written in C, vectorized with SIMD and running without the GIL. Getting any speedup on top of that with plain Python threads is the surprising part.

The practical takeaway is that row.sum() is close to the worst case for threads. If your per-row work is one fast NumPy call, threads probably won't help, and on tall data they'll hurt. The picture changes as soon as each row does a little more, which is the next section.

“What I found through systematic performance analysis is the shape of the frame. Is it wide? Is it tall? Is it square? Makes a big difference.”

Christopher Ariza

When free threading is 10x faster: Python objects in every row

Order of magnitude improvement. Tall, square and wide arrays drawn as grids of small cells, each sending a long blue arrow to the right. Callouts read "when each row creates intermediate arrays and objects" and "square and wide arrays ran an order of magnitude faster".

Change the per-row function from a single sum() to something a bit more realistic and the results flip. The second benchmark finds the even numbers in each row and adds them up. That takes a few steps: row % 2 == 0 builds a new Boolean array, indexing with it builds another array with just the evens, and only then does the sum run.

Each step is still NumPy doing the heavy work in C. But every step also hands a new array object back to Python, and the interpreter has to allocate it, count references to it and throw it away. That's Python-level overhead on every row, and under the GIL it's exactly the part that serializes.

With the GIL removed, that overhead runs in parallel too. On square and wide arrays, the threaded version ran an order of magnitude faster than the sequential one. That's roughly ten times, well past the 2x of the StaticFrame apply.

Why do intermediate objects make threads win? Because they're where the GIL used to bite. Pure C loops in NumPy already ran without the lock, so threading them gained little. The interpreter work between those loops - creating arrays, calling methods, building results - is what free threading unlocks. The more Python happens per item, the more there is to gain.

To make this concrete, here's the shape of that second test, verified on Python 3.14t with NumPy and the conditional-futures package covered later in this guide:

import numpy as np
from conditional_futures import ConditionalThreadPoolExecutor

def evens_total(row: np.ndarray) -> int:
    return int(row[row % 2 == 0].sum())

data = np.arange(10_000 * 10_000).reshape(10_000, 10_000)

with ConditionalThreadPoolExecutor(max_workers=8) as pool:
    totals = list(pool.map(evens_total, data))

Swap in a plain concurrent.futures.ThreadPoolExecutor if you'd rather, but then you're on your own when the GIL is enabled.

This is also why the earlier rule of thumb is so useful. Most real per-row code isn't a single reduction. It slices, filters, builds dictionaries or calls a helper, and every one of those creates objects. That's the kind of workload where free-threaded Python moves from interesting to worth adopting. An order of magnitude is a pretty good bar for whether a change is worth the trouble.

“If I can go an order of magnitude faster, I have every reason to be happy.”

Christopher Ariza

C extensions and free threading: rebuild, opt in, double your wheels

C extensions must opt in. A cube labelled "C extensions must opt in" passes through a "Rebuild & declare safe" stage to two grids labelled "ArrayKit: doubling its wheels from 12 to 24". Below, a wall of package blocks, mostly lit blue: "218 of the top 360 packages are ready".

Pure Python code runs on the free-threaded build as is. Compiled extensions don't get that pass. A C extension built for regular CPython won't load on python3.14t; it has to be rebuilt against the free-threaded build. And rebuilding isn't enough on its own. The module also has to declare that it can run without the GIL, which in C means setting the Py_mod_gil slot to Py_MOD_GIL_NOT_USED in its module definition. An extension that doesn't declare it still loads, but the interpreter turns the GIL back on to protect it, which is the trap in the next section.

That declaration is a promise, not a proof. Compatible means the module agreed to run without the GIL. It doesn't mean the module is free of race conditions.

ArrayKit, the C extension behind much of StaticFrame's speed, went through this. The code changes were only part of the job. The bigger surprise was continuous integration: every combination of Python version and platform already needed its own wheel, which came to 12 builds. Adding free-threaded variants of each one doubled that to 24 wheels. With GitHub Actions doing the builds it's manageable, but that's a lot of binaries to publish and test for every release.

Python 3.15 is meant to ease that. It brings a stable ABI for free-threaded builds, called abi3t (PEP 803). As it was described on the show, the hope is a single wheel that works on both free-threaded and regular Python, which would cut the matrix back down.

How far along is everyone else? Hugo van Kemenade's free-threaded wheels tracker follows popular packages on PyPI, in the style of the old Python 3 readiness pages. At the time of the recording it showed 218 of the top 360 with free-threaded wheels. For something many developers still think of as an experiment, that's a strong number, and the data science stack is well represented. That makes sense: people chewing through a billion rows on a 20-core machine have the most to gain from using all 20 cores.

Quansight's free-threading guide is the other bookmark worth having. It covers installation and the status of major libraries, with a tracker of its own.

“So all C extension packages need to be explicitly rebuilt for free-threaded Python and explicitly opt into that behavior.”

Christopher Ariza

How the GIL comes back: one import re-enables it for the whole process

GIL re-enablement and performance penalty. Three fast blue arrows hit a warning hexagon reading "importing a compiled package that hasn't opted in, such as psycopg2", which "re-enables it for the whole process with only a warning". A jagged orange line exits, captioned "threaded code gets slower".

This next part catches people off guard: in the free-threaded build the GIL isn't removed, only disabled, and it can come back.

There are two ways that happens. You can turn it on deliberately when you start Python. Or it turns itself on the moment you import a compiled module that hasn't declared it can run without the GIL. psycopg2, the most popular PostgreSQL adapter for the most popular database, is the example everyone hits. Importing it prints a warning, not an error:

RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module
'psycopg2._psycopg', which has not declared that it can run safely without the GIL.
To override this behavior and keep the GIL disabled (at your own risk), run with
PYTHON_GIL=0 or -Xgil=0.

From then on, the GIL is enabled for the entire process, every thread, every module. The GIL is a zombie that any import can raise from the dead.

Why is that so bad? Because code written to depend on free threading is usually code that spins up a thread pool for CPU-bound work. On a GIL build, that same pool doesn't just lose its speedup. It runs slower than plain sequential code, sometimes much slower, because you pay for threads, context switches and memory without any extra compute to show for it. A job that was 10x faster can suddenly take 10 times as long while pinning every core.

And it can happen at any point in a program's life. A function with an import inside it, a rarely used code path, a plugin loaded late: the switch flips whenever that import runs.

You can check the current state at runtime. The function still has a leading underscore, so treat it as provisional:

import sys

print(sys._is_gil_enabled())  # False on a free-threaded build, until something turns it on

The warning's escape hatch is PYTHON_GIL=0 (or python -X gil=0), which keeps the GIL off even after loading an unmarked module. Note the "at your own risk". That setting doesn't make the extension thread-safe. It says the extension's author hasn't promised it is, and you're running it without the lock anyway. For a production database driver, that's a real gamble.

How would you even notice this in production? Log sys._is_gil_enabled() after your imports, or check it at the start of any job that relies on threads for speed. It costs nothing and turns a mysterious slowdown into one obvious line in a log.

“In the free-threaded binary of Python, the GIL is not removed. It is disabled.”

Christopher Ariza

Free-threaded Python for web apps: the dependency problem

270 packages funnel down to a smaller cluster, "maybe 150 at runtime", that "are unlikely all ready", next to a shield: "fewer dependencies also means less supply chain exposure". Below, a balance with "threads should help a web app" on one side and "test the web server's threading first" on the other.

On paper, a web app is a great fit for free threading. A server with eight cores could run eight real threads in one process instead of eight worker processes, each with its own copy of the app in memory. That's more CPU for request handling without multiplying the RAM bill. Async frameworks already overlap I/O well, but async still runs Python code on one core at a time. Fast, lightweight threads can do more.

So what's stopping it? Count the packages. Michael Kennedy ran a quick wc -l on his website's virtual environment while recording and found more than 270. Leave out the development-only tools and call it 150 at runtime. What are the chances all 150 are ready for free threading? About zero.

Not every package has to be. A Markdown parser that only ever handles one document per call doesn't care about threads. The danger is the compiled ones: a single extension without free-threaded support turns the GIL back on for the whole process. That's starting to feel a bit like the Python 2 to 3 migration, where one dependency that hadn't moved could hold back everything.

Where should a web developer start? With the web server. If request handling is where the time goes, find out what threading story your server has, build a small isolated test with free-threaded Python and see whether throughput actually improves before touching the rest of the stack.

There's a second reason to trim dependencies that has nothing to do with threads. Many packages get pulled in for one small feature of a much larger library. Resolving a DNS name, for instance, is about 20 lines of code that an AI agent can write, review and make thread-safe on request, versus a DNS library that brings four transitive dependencies you don't control. Owned code trades some reuse for control.

It also shrinks your supply chain exposure, which is a big concern in 2026. A static 20-line file you wrote can't be hijacked through a compromised release. Fetter, a Rust tool Chris built while CTO at a finance firm, came out of exactly this worry. It scans every Python installation and site-packages directory on a machine, and lists the packages with known CVEs, ranked. It works by scanning, so a package someone installs won't show up until the next scan. But when news breaks about a compromised package, one search tells you whether anyone in the organization has it.

“There is a benefit from reducing your dependency exposure for not only supporting new features like this, but also for security.”

Christopher Ariza

Thread safety in free-threaded Python: passing CI isn't enough

Passing CI isn't thread safety. Left, a heap of cracked orange and grey blocks around the caption "worry that Python code isn't written for threads". Right, an orderly grid of locked blue tiles around a shield: "avoiding in-place mutation and using immutable data removes most problems".

Developers who came up in C++ or C# learned to think about threads all the time: pointers, shared data, allocations, race conditions, deadlocks. Every design decision got a quick mental check for what happens when two threads touch it at once. Python developers mostly haven't had to. You rarely hear anyone explain why they reached for a reentrant lock here and a semaphore there.

That's what makes free threading a little nerve-racking. A package can build for 3.14t, load without re-enabling the GIL and pass its whole test suite, and still have a race condition. Those are two different properties. Few Python projects have multithreaded scenarios in their CI, so nothing exercises two threads mutating the same object at the same time.

What's the best defense? Don't share mutable state. If threads read shared data but never change it in place, most of the problems those locks exist for simply can't happen. Each worker takes an input, builds its own result and returns it, and the results get combined afterward. That's exactly the pattern a ThreadPoolExecutor.map over rows encourages.

Immutable data structures make the rule enforceable rather than a matter of discipline. That's the argument behind StaticFrame's immutable DataFrames, and it's why Python 3.15's new built-in frozen dictionary matters more in a multithreaded world than it would have a few years ago. For NumPy, setting arr.flags.writeable = False makes an array read-only, so an accidental in-place write raises an error instead of quietly corrupting another thread's view. Immortal objects like None are the same idea built into the interpreter: things that never change are the easiest things to share.

When you really do need shared, mutable state, Python already has the tools. threading.Lock, RLock, Semaphore, Condition and thread-safe queues have been in the standard library for many years. They just haven't been needed much.

The testing gap is the other half. Thread-safety bugs show up under load, so test under load. A battery of stress tests that hammer shared code from many threads on a many-core machine is tedious to write by hand, which makes it a good job for an AI agent: ask it for parallel stress tests of the code paths you plan to run threaded, and run them on every build.

“Use immutable data structures and don't try to mutate things in place while you're doing your multi-threading and you solve a huge number you just avoid a ton of the problems.”

Christopher Ariza

conditional-futures: a thread pool that falls back when the GIL is on

conditional-futures: ConditionalThreadPoolExecutor. An input task reaches a "GIL status check" diamond. When "GIL is off", it fans out into four parallel arrows labelled "uses threads" and "parallel results". When "GIL is on", a single path "runs work in the calling thread" to a serialized result.

concurrent.futures is one of the nicer corners of the standard library. ThreadPoolExecutor and ProcessPoolExecutor share one interface, so switching between threads and processes is a one-word change. That's made it easy for years to keep checking whether threads had started paying off yet. Python 3.14 added an InterpreterPoolExecutor with the same interface for sub-interpreters, the other escape hatch for parallel Python.

The trouble is that code written for free threading can't be sure it'll get it. A library might be installed on a regular GIL build, or a user's environment might import an unmarked extension and turn the GIL back on. Then the thread pool that made the code fast makes it slower than doing the work sequentially.

conditional-futures handles that for you. Its ConditionalThreadPoolExecutor is a drop-in replacement for ThreadPoolExecutor with the same constructor arguments, submit and map. When you enter the with block, it checks sys._is_gil_enabled():

  • GIL off: you get a real ThreadPoolExecutor with your max_workers.
  • GIL on: you get an executor that runs each task right away in the calling thread. No threads are created at all.

You may get a thread pool with threads, or something that looks exactly like one and runs serially. Your code doesn't change either way:

from conditional_futures import ConditionalThreadPoolExecutor

def score(n: int) -> int:
    return sum(i * i for i in range(n))

with ConditionalThreadPoolExecutor(max_workers=8) as pool:
    results = list(pool.map(score, range(10_000)))

Install it with uv pip install conditional-futures. Because the check happens each time a pool is created, rather than once at import, it notices if something re-enabled the GIL earlier in the run. The package's own comment says as much: the result can't be cached.

Why not just let the threads run anyway? Because degrading under the GIL doesn't mean keeping a smaller speedup. A regular thread pool on a GIL build adds thread, context-switching and memory overhead with no extra compute to show for it, and it can end up very slow. Falling back to the calling thread avoids that penalty entirely, which gives library authors one interface that's safe on any Python.

“You may get a thread pool with threads, or you may get something that looks like a thread pool with threads, but it's actually just conventional serial processing.”

Christopher Ariza

AI coding agents write serial code first

AI agent code evolution. A robot labelled "Agents write serial code first" sends work around a looping track, "in Python and Rust they write a plain loop", to a gate marked "until asked to parallelize". Past it, the path splits into many blue lanes labelled ThreadPoolExecutor, async/await and "with Rayon in Rust".

Free threading only helps code that actually uses threads. And a lot of new code is now written by AI agents, which default to the plain loop.

That's true in Python, where you might expect it, given how little threading has paid off historically. It's also true in Rust, where the language and its libraries make parallelism easy and safe. Ask an agent to process a batch of items and you'll usually get a for loop, one item after another, until you ask for something else.

The classic Python case is downloading a batch of files in a loop. That's I/O-bound work, where threads have always helped, even under the GIL. It's a few extra lines with a thread pool, which is exactly the kind of thing that's easy to skip. Select the loop and tell the agent to make it concurrent, and it'll do it. But someone has to look at the code, notice it's serial and ask.

On the Rust side, the equivalent nudge is Rayon. Rayon is a data-parallelism library: change .iter() to .par_iter() on a collection and it splits the work across a thread pool. If a loop does real computation on every iteration, telling the agent to use Rayon to make it multi-threaded usually produces good, fast code. Most of the time.

What's the Python equivalent of that one-word change? The closest is ThreadPoolExecutor.map (or ConditionalThreadPoolExecutor.map from the previous section) wrapped around the per-item function. On free-threaded Python that now speeds up CPU-bound loops too, not just downloads.

So build the prompt into your habits:

  • Look for the loop. Any loop over independent items with real work per item is a candidate.
  • Ask for it explicitly. Name the tool: a thread pool in Python, Rayon in Rust.

Of course, "most of the time" is the catch with all threading. Sometimes the result is a program that hangs at zero CPU usage while two threads wait on each other forever. Review what the agent wrote before you trust it.

“But it takes looking at the code, realizing it's serial, and then asking.”

Christopher Ariza

Getting started with free-threaded Python

Takeaway. Three glowing pedestals in a row: a CPU chip on "try free-threaded Python on CPU-bound work", floating cubes on "with real Python work per item", and a radar eye on "and check that the GIL stays off".

The last three to five years brought a lot of work on making Python faster, and it shows. Making a library 30% faster is worth celebrating. But running on 20 cores instead of one is a different scale of improvement, and for CPU-bound work free threading is the change that can deliver it.

The biggest effect may show up in libraries rather than your own code. Until now, Python's options for parallelism were heavy. Multiprocessing works for big jobs, but it has to copy data between processes, and a library can't know how many cores or how much work it'll get, so library authors mostly avoided it. Lightweight threads that really run in parallel open up a whole range of small and medium-sized work units that can use concurrency. Library authors can build multithreaded routines into everyday operations, and their users just call an ordinary function and get the speedup.

To try it on your own work, the three steps in the image above sum it up:

  • Pick CPU-bound work. Row-wise transforms, parsing, simulation, anything that pins one core today.
  • Make sure each item does real Python work. One fast NumPy call per row is too little. Slicing, filtering and building objects per item is where threads pay off.
  • Check that the GIL stays off. Run on python3.14t, confirm the build with python -VV, and check sys._is_gil_enabled() after your imports. Or let ConditionalThreadPoolExecutor decide for you.

Then measure on tall, square and wide versions of your data, not one convenient example.

The GIL being able to switch itself back on was the surprise of the episode, and it's the thing to watch for most if you're shipping a library that counts on free threading. You don't know which Python your users will run, or what else they'll import alongside your code.

If you want to go deeper on the fundamentals behind all of this (threads, asyncio, multiprocessing and when to use which), Talk Python Training's Python concurrency deep dive course covers them. Christopher's PyBay talk slides and benchmark code are in his present-free-thread repository.

“But for the first time in Python, we now have lightweight true thread concurrency.”

Christopher Ariza

Talk Python's Mastodon Michael Kennedy's Mastodon