Talks - Ken Jin, Jules Poon: How two undergrads from the other side of the planet are speeding up...

Learn how two undergrad students are revolutionizing Python's performance with a new JIT compiler in CPython 3.13, featuring optimization passes and type specialization.

Key takeaways
  • CPython 3.13 includes an experimental JIT compiler that uses multiple optimization passes to improve performance
  • The optimization pipeline includes guard elimination, function inlining, deferred object creation, and register allocation
  • Traces are generated from straight-line code sequences, starting at loop backward edges and limited to ~800 bytecode instructions
  • Specializing adaptive interpreter (Tier 1) rewrites bytecode to faster versions based on observed runtime types
  • Abstract interpretation analyzes code by operating on abstractions of Python values rather than concrete values
  • Current optimizations can reduce function call overhead by ~30% by eliminating frame creation and argument copying
  • Optimization scope focuses on traces rather than whole functions, with plans to expand to function-level optimization in 3.14
  • JIT is not enabled by default as it currently speeds up some applications while slowing down others
  • Best performance gains seen in pure Python code and data classes, less impact on code using C extensions
  • Guard elimination reduces type checking overhead by removing redundant checks when types are already known