Using type annotations as specialization hints in CPython's JIT — worth pursuing?
Discussions on Python.org
Using type annotations as specialization hints in CPython's JIT — worth pursuing?
CPython’s specializing adaptive interpreter (PEP 659) and the tier-two JIT introduced in 3.13 already specialize bytecode based on observed runtime types, using inline-cache-style guards and deoptimizing back to generic bytecode when a guard fails. This works well, but it means every function still pays a “cold start” cost — the interpreter has to run a few times before it learns which types actually show up. Static type annotations (def f(x: int) -> int) are already present in a huge fraction ...
0 comments
No comments yet.