A tour of CPython's runtime
summary
CPython shows concrete wins: specialization in 3.11 yields ~25% speedup, and a new tracing JIT pipeline builds micro op traces from a DSL, then uses a copy and patch strategy that compiles C templates at build time (LLVM only at build) and patches relocations into executable memory. Early results: the micro-op interpreter is ~20% slower, but JITting those ops returns parity with baseline; tracing coverage rises from ~6% to ~65% (target ~91%), and initial memory overhead falls from ~+10% toward much smaller numbers.
AI-written summary · about
chapters (18)
- 0:00CPython runtime optimization intro
- 2:31What makes Python hard to optimize
- 4:59CPython architecture and constraints
- 6:22Dynamic languages with JIT compilation
- 7:25Fibonacci execution with specialization
- 11:57Micro-op traces and JIT compiler
- 15:23Optimizing micro-op traces
- 18:10Micro-op interpreter overhead challenges
- 19:14Copy-and-patch compilation for JIT
- 23:25How copy-and-patch works
- 29:41Platform support and complexity
- 30:45JIT performance and memory overhead
- 33:31Future stack caching and register allocation
- 38:26Trace stitching and side-exit optimizations
- 43:58CPython performance engineering efforts
- 47:26Q&A on JIT performance
- 58:53JIT security and ecosystem
- 1:00:16Benchmarking pure Python impact
related talks
29mWhat they don't tell you about building a JIT compiler for CPython
24mHow two undergrads from the other side of the planet are speeding up...
29mBuilding a JIT compiler for CPython
29mHow we are making CPython faster. Past, present and future.
48mPython Performance: Past, Present and Future
57mPython and PyPy performance (not) for dummies
22mPyPy in production
32mProfiling at the speed of light
