~/talk

CPython's Compilation Pipeline

Talkat PyCon US 2024 · 2024-05-15..05-23· [python, web-performance]
slides:none on file

Claim: CPython 3.13 refactors the compiler so Python code can observe and run intermediate stages, replacing the old four steps with source -- tokens -- AST -- optimized AST -- pseudo bytecode -- optimized pseudo bytecode -- bytecode -- code object. Tests for the peephole optimizer, code generator and assembler run as unit tests written in Python using _test_internal_capi, not C. A simple GUI called Codoscope visualizes the pipeline; the refactor already enables focused unit tests and clearer, less coupled compiler code.

AI-written summary · about

  1. 0:00CPython compiler pipeline intro
  2. 1:09Python to bytecode compilation
  3. 2:54Existing compiler stages
  4. 4:23Motivation for refactoring
  5. 6:52Impact on codebase structure
  6. 9:01Performance driving changes
  7. 10:24Old vs new compiler stages
  8. 13:36AST to bytecode refactor
  9. 17:16Assembler to bytecode
  10. 19:25New stages via test_internal_capi
  11. 20:32Unit testing optimizations
  12. 23:01Visualizing compilation
  13. 23:44Summary and future
  14. 24:30Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.