Adapting CPython for Yk tratt.net · 13 points · 0 comments · HN thread TL;DR Lau...
HN Best 200 @best
Adapting CPython for Yk tratt.net · 13 points · 0 comments · HN thread
TL;DR Laurie Tratt reports that CPython can be adapted to run on yk, his tool that adds a meta-tracing JIT to C interpreters, with about 450 lines of changes over roughly 3-4 days of work. On a subset of the AWFY benchmarks, the resulting ykcpython beats normal CPython on 12 of 13 benchmarks and beats CPython's experimental JIT on 8 of 13, though he stresses it is not ready for real use.
- Adapting CPython took about 3-4 days on top of a week and a half of generic yk bug fixes; the author started from CPython's tier 2 interpreter, which needed about 80 lines of yk support.
- On the author's table, ykcpython is faster than normal CPython 3.15.1 on every benchmark except DeltaBlue (about 2.5% slower), and faster than the experimental JIT on 8 of 13 benchmarks.
- Making dispatch loads idempotent (yk_idempotent) was the biggest single win, cutting Mandelbrot from about 13.7s to 5.0s and reducing HIR output from 20,772 to 7,648 lines.
- Other optimisations included yk_outline for GC-link code, a YkLocation at executor start (DeltaBlue 8.64s), yk_unroll for small loops such as _PyFrame_Initialize, and yk_indirect_inline for indirect calls like sq_length.
- The author says the benchmarks flatter tracing, that the test-suite passes but memory use is higher, and that many bottlenecks in yk itself remain to be fixed.
Discussion No comments have been posted on this story yet, so there is no discussion to summarise.