The work tests whether yk, a meta-tracing JIT that adds compilation to lightly modified C interpreters, can deliver gains in a large and complex system such as CPython. Rather than replacing Python’s interpreter, yk records its execution through hot loops, optimizes the resulting traces, and generates machine code. The adaptation ultimately used CPython’s tier 2 interpreter, an alternative implementation of core interpreter operations that also supports CPython’s experimental JIT. This proved a better fit than tier 1: CPython’s quickening repeatedly changes generic opcodes into specialized ones, and the initial approach discarded traces whenever those changes occurred, often before they could pay for themselves.
The resulting ykcpython required roughly 450 lines of changes, with about 80 lines for tier 2 support; the direct adaptation took three to four days, following a week and a half of fixing general yk bugs. On 13 AWFY benchmarks, ykcpython beat standard CPython in 12, and beat CPython with its experimental JIT in eight. It was especially fast on Mandelbrot, taking 4.20 seconds versus 6.94 for the experimental JIT and 11.66 for standard CPython. It lost to standard CPython only on DeltaBlue, by about 2.5%. These measurements use 30 process runs on a 64-core AMD EPYC system. The results show that yk can improve a large interpreter, but ykcpython is not ready for users, and benchmark gains do not guarantee similar results across real-world programs.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.