Making CPython Fast Using Trace-based Optimisations
summary
An experimental tracing VM called Popeye tracing VM implements a lower-level “spam” instruction set inside CPython, records hot bytecode traces, applies specialization, escape analysis and deferred object materialization, and then emits machine code for traces. The implementation keeps traces on a timed cache, uses inline guards and shadow stacks to avoid unnecessary allocations, and shows roughly 3x interpreter speedup and ~10x when compiled in benchmarks; changes are invasive but mostly local to CPython bytecode handling.
AI-written summary · about
chapters (21)
- 0:00Introduzione
- 1:53CPython VM
- 3:25What is Tracing?
- 5:37Modifying CPython for Tracing
- 10:03Optimising Traces
- 11:05Problems with Tracing Bytecode
- 12:08Lower-Level Bytecodes
- 17:10SPAM instructions
- 19:29Tracing with SPAM
- 21:17SPAM equivalents
- 23:18SPAM functions (2)
- 25:10The Main Trace-Based Optimisations
- 26:40Optimiser Chain
- 32:00Guards
- 37:10Starting Trace
- 38:09Specialisation (1)
- 39:19Specialiser Output
- 41:02D.O.C. (3)
- 43:32Compilation
- 46:26Thank You For Listening
- 51:20Making CPython Fast With Trace-Based Optimisations
related talks
24mHow two undergrads from the other side of the planet are speeding up...
01h 03mA tour of CPython's runtime
15mTracing Just-in-time Compilation for Effects and Handlers
32mProfiling at the speed of light
32mWriting performant code for modern Python interpreters
29mBuilding a JIT compiler for CPython
26mPython Performance at Scale - Making Python Faster at Instagram
23mMemoirs of a Python Object: Memory Management and Improving Performance
