Python BytesMichael Kennedy and Calvin Hendryx-ParkerAll episodes
#497 Faster than light profiling
Topics covered in this episode:
- Tachyon: A sampling profiler ships in Python 3.15's stdlib
- Python Workers are now generally available on Cloudflare
- Flet 1.0 - build cross-platform apps in Python
- marimo-book: Build static books from marimo notebooks
- Extras
- Joke
Sponsored by Logfire from Pydantic: pythonbytes.fm/logfire
Connect with the hosts
- Michael: Mastodon / BlueSky / X / LinkedIn
- Calvin: Mastodon / BlueSky / X / LinkedIn
- Show: Mastodon / BlueSky / X
Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesday at 7am PT. Older video versions available there too.
Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it.
Michael #1: Tachyon: A sampling profiler ships in Python 3.15's stdlib
- Python 3.15 adds the profiling package per PEP 799: profiling.tracing (where cProfile moved) and profiling.sampling, the new sampler called Tachyon
- py-spy and Austin exist but copy raw interpreter bytes with no API, so every CPython release risks breaking them; one in the stdlib is a contract to stop breaking profilers
- Defaults: 1 kHz, main thread, wall clock, and a -live top-like view for poking at a slow server
- Output is flexible: pstats, -flamegraph, -diff-flamegraph against a baseline, -heatmap on source lines, -opcodes for specialized bytecode, -gecko for Firefox Profiler with GIL and GC markers
- Profiling modes: wall, cpu, gil (which function is starving my other threads?), and exception, plus -async-aware to see the task graph instead of just select(), -all-threads, and -subprocesses forking a profiler per child
- Near-zero overhead for production; guidance is 10-30 second windows on representative load, and free-threaded builds divide the rate by thread count
- Attach to a running PID, same minor version only; ptrace permissions are the main friction. A 3.14 backport already exists on GitHub
- Caveat: it only sees Python frames, so 90% in calculate() hides NumPy underneath. For native stacks there's Cronon from HRT, 200k samples/sec over DWARF, not yet open source
Calvin #2: Python Workers are now generally available on Cloudflare
- Python Workers are out of beta - now GA, "first-class" language on Cloudflare's Developer Platform
- No more manual JS interop: bindings (queues, R2, D1, Durable Objects) now work natively in Python, e.g. self.env.QUEUE.send({...})
- Runs on Pyodide (WASM-compiled Python), with real TCP socket support for DB connectivity
- Frameworks supported: FastAPI, Django, Flask; AI libs like OpenAI SDK, LangChain, MCP
- Underlying platform work formalized as PEP 783 (PyEmscripten), after a year of discussion
- Bottom