Python performance

Python performance gets real attention in these guides: profiling with Tachyon, CPython's new JIT, caching with DiskCache, GPUs and multi-core async. Faster Python starts with knowing where the time goes, and Python 3.15 ships a sampling profiler in the standard library that can attach to a live production app by PID. From there the options spread out. Python 3.14's official Windows and macOS installers include an experimental JIT. DiskCache turns a decorator into a cache that survives restarts, NVIDIA's CUDA Python and RAPIDS put a GPU behind your code, and free-threaded Python lets new runtimes like TonIO use every core instead of one.

Each guide comes from a Talk Python to Me conversation with the people who build these tools, illustrated, with quotes and links. Brandt Bucher explains why the JIT compiles hot paths instead of whole functions. Tachyon's first prototype managed two samples a second and now does over a million. Ray spreads a script across hundreds of machines, the Rust guide's advice is to measure before you rewrite, and web framework maintainers share tips that cost almost nothing: fix your queries and upgrade Python.

5 visual guides, the ones most focused on this topic first.

Tachyon, Python 3.15's Built-in Sampling Profiler

With Pablo Galindo Salgado and László Kiss Kollár

Python 3.15 ships Tachyon, a sampling profiler in the standard library under the name profiling.sampling. It reads a running program's stack from a separate process, so it can attach to a live production app by PID at almost zero overhead. The first prototype managed two samples a second. It now does over a million.

Read the guide →

DiskCache, Your Secret Python Performance Weapon

With Vincent D. Warmerdam

DiskCache is a Python library that works like a dictionary but stores everything in SQLite on disk, so cached values survive restarts and can be shared by every process on the machine. It's a fit for web apps and for data work alike, from avoiding repeated expensive LLM calls to surviving long notebook runs. Disk is cheap and fast now, so for a lot of caching jobs you don't need Redis or more RAM. You need a decorator.

Read the guide →

Free-Threaded Python and NumPy

With Christopher Ariza

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.

Read the guide →

TonIO and Multi-core Async Python

With Giovanni Barillari

asyncio runs on one thread, so on an 18-core machine your async Python code uses about one core, however fast its event loop is. Free-threaded Python 3.14t takes the GIL away, and TonIO, a new runtime from Granian creator Giovanni Barillari, is built for it: one worker thread per core, a short list of primitives in place of asyncio's many, and a hard refusal to start if the GIL is present. It's alpha, it brings real thread hazards with it, and at the time of recording it ran only on Linux and macOS.

Read the guide →

Rust for Python Developers

With Christopher Trudeau

Rust is already underneath a lot of the Python you run: ruff, uv, Pydantic, Polars and Granian. You don't need to write Rust to benefit, but knowing enough to read it pays off. The syntax looks like typed Python and cargo feels a lot like uv. What's genuinely new is the memory model Python hides from you, and the advice for using Rust from Python is to measure before you rewrite anything.

Read the guide →

Browse all guides →

Talk Python's Mastodon Michael Kennedy's Mastodon