Overview of Talk Python to Me #565: Tachyon, Python 3.15’s Built-in Sampling Profiler
In this episode, Michael Kennedy talks with CPython core developer Pablo Galindo Salgado and Bloomberg/Hudson River Trading engineer Laszlo Kiss-Color about Tachyon, a new sampling profiler built into Python 3.15. The conversation explains why traditional tracing profilers can be too slow for real production use, how Tachyon was designed to solve that problem with near-zero overhead, and how it fits into a broader push to make Python faster and easier to optimize in real workloads.
Why profiling matters
The guests open by emphasizing a common performance trap: developers often guess what is slow instead of measuring it.
- Profiling frequently reveals that the real bottleneck is something simple:
- a poor data structure choice
- excessive imports
- unexpected I/O waits
- GIL contention
- exception-heavy code paths
- In large systems, performance problems are often anti-intuitive and buried under layers of frameworks, libraries, and infrastructure.
- The key takeaway: you need real measurements from the actual workload, not assumptions from local reproduction.
From tracing profilers to sampling profilers
The episode contrasts Python’s older profiling tools with the new approach:
Traditional profilers
profileandcProfileare tracing profilers.- They record every function call, which makes them:
- very accurate
- but much slower to run
- The old pure-Python profiler (
profile) is especially heavy because it profiles by running inside the process in Python itself. cProfileis faster, but still adds enough overhead that it can distort results and make production use painful.
Why sampling wins for many cases
- Tachyon is a sampling profiler, meaning it periodically inspects the running program instead of tracing every call.
- This makes it:
- much lower overhead
- suitable for live production systems
- better for “what is happening right now?” debugging
- The tradeoff is that sampling is statistical rather than exact, but that is often the right tradeoff for real-world diagnostics.
Tachyon in Python 3.15
Tachyon is the big new feature discussed in the episode.
What it is
- A built-in sampling profiler in Python 3.15
- Part of the new profiling direction for CPython
- Intended to be the standard, supported way to do fast profiling in Python
Why it was added to the standard library
The guests explain three major reasons:
- Stability: third-party profilers can break when CPython internals change.
- Reference implementation: if CPython itself provides the profiler, others can build compatible tools more reliably.
- Access to interpreter internals: Tachyon can take advantage of CPython-aware optimizations that external tools can’t easily use.
Performance improvement
- The project started with a prototype that sampled at about 2 Hz
- By the time of the episode, it had been improved to well over 1,000,000 Hz in some scenarios
- In normal use, the intended production rates are far lower and still extremely cheap to run
What Tachyon can do
Tachyon is more than “just” a profiler. The episode highlights a surprisingly rich feature set:
Core capabilities
- Attach to a live running process
- Profile with very low overhead
- Produce output for:
- flame graphs
- heat maps
- differential flame graphs
- top-like live views
- stack dumps
- Run programs under profiling at startup for development and benchmarking
Different profiling modes
The guests discuss several filters/modes that make Tachyon more useful than a basic sampler:
-
Wall clock mode
Measures elapsed time as the user sees it, including sleeping and waiting on I/O. -
CPU mode
Focuses only on time the program is actually executing on CPU, filtering out waiting time. -
GIL mode
Helps analyze how much time is spent holding the GIL and how threads interact around it. -
Exception mode
Shows how much time is spent in exception-heavy code paths, which can be surprisingly expensive. -
All / timeline-style views
Useful for seeing thread behavior over time, contention, and task scheduling patterns.
Output and analysis features
- Can generate flame graphs and heat maps
- Can compare runs to show what got faster or slower
- Supports async-aware analysis, which is especially important for event-loop-based applications
- Includes a
dumpmode for inspecting stuck or frozen processes
Why attach-based profiling is a big deal
A major theme of the episode is that attaching to live production systems is what makes Tachyon especially valuable.
- Startup profiling often includes too much noise:
- imports
- initialization
- one-time setup work
- Production attach lets you:
- observe the real workload
- capture actual hot paths
- profile only the interesting part of a system
- This is especially useful when:
- the issue only appears under real traffic
- the problem is intermittent
- reproducing locally is difficult or impossible
Relationship to PEP 768 and profiling infrastructure
The guests explain that Tachyon became practical because of the work done for PEP 768, the safe external debugger interface for CPython.
Why PEP 768 mattered
- It introduced a way for tools to attach to running CPython processes
- Originally designed for debugger-style workflows
- That same mechanism made high-performance sampling profiling possible
PEP 799 and the new profiling package
The episode also discusses a planned cleanup of Python’s profiling ecosystem:
- A dedicated profiling package is intended to organize the tooling more cleanly
- The old
profilemodule is effectively on the way out - The new structure is meant to make the choice clearer:
- tracing profilers
- sampling profilers
Python performance context: Faster CPython and free threading
The conversation broadens into other performance work happening in CPython.
Faster CPython
- The Faster CPython initiative has already produced major speedups in recent Python releases
- The early wins were easier to find; current gains are harder and more subtle
- Profiling is crucial for validating whether a change actually improved real workloads
Free-threaded Python / GIL removal
- Free-threading has strong potential, but also introduces new complexity
- The guests warn that many ecosystem libraries have not historically had to think deeply about race conditions
- This may lead to a wave of:
- subtle bugs
- deadlocks
- non-linear scaling surprises
- Profiling will be even more important in that world, because “threaded” does not automatically mean “faster”
Explicit lazy imports
The episode briefly touches on explicit lazy imports, another performance-related feature.
Why they matter
- Importing a package can trigger a large dependency chain
- This affects:
- startup time
- memory usage
- garbage collector overhead
- Lazy imports help by delaying work until the imported functionality is actually needed
Real-world impact
The guests note that lazy imports can be especially important for:
- CLI tools
- serverless applications
- short-lived subprocesses
- large server apps where only part of the codebase is used in any given process
Limitations and future work
Tachyon is powerful, but it has important limits:
- It profiles Python-level execution, not C extension internals
- If the bottleneck is in:
- NumPy
- Pandas
- Polars
- CUDA-backed libraries
- kernel-level work then Tachyon can show who called into that code, but not the internals of the C layer
The guests mention an internal, more expansive profiler called Chronon at Hudson River Trading that can profile:
- multiple Python versions
- C code
- kernel code
- streaming/live dashboards
That tool is planned to be open sourced later, but it is separate from Tachyon.
Key takeaways
- Don’t guess where Python is slow — measure it.
- Tracing profilers are accurate but intrusive.
- Tachyon brings low-overhead sampling profiling into Python 3.15’s standard library.
- Attaching to live production processes is the real superpower.
- The new profiling stack is part of a larger CPython performance story, including Faster CPython, lazy imports, and free-threading.
Practical recommendations
If you’re working in Python 3.15 or planning an upgrade, the episode suggests:
- Use Tachyon /
profiling.samplingfor live performance investigations - Use CPU mode when you want algorithmic hotspots
- Use wall clock mode when waiting/I/O is part of the problem
- Use GIL mode to understand thread contention
- Use exception mode if exception-heavy code might be hurting performance
- Consider lazy imports to reduce startup cost and memory footprint
- Keep an eye on the larger CPython performance roadmap, especially if you use threads or high-performance numerical libraries
Notable insight
“The best profiling tool is the one that tells you what’s actually happening in production.”
That idea drives the entire episode: Tachyon is valuable because it makes that answer easy to get, with minimal disruption to the system being measured.
