Brandt Bucher – A JIT Compiler for CPython
Why Hacker News recommends it
It is the go-to explanation of how CPython's JIT works and why its design is so simple.
What it is
Brandt Bucher presents his prototype JIT compiler for CPython at the 2023 Core Developer Sprint. He explains the copy-and-patch approach, the implementation and its performance.
Recommended by 1 HN commenters across 1 different months, 2023 to 2024.
What Hacker News said
Strong rec vanderZwan · 2024-01 · on “Python 3.13 Gets a JIT”
You're right, and in this case "foundational work" even undersells how minimal this work really is compared to the results it already gets. I recommend that people watch Brandt Bucher's "A JIT Compiler for CPython" from last year's CPython Core Developer Sprint[0]. It gives a good impression of the current implementation and its limitations, and some hints at what may or may not work out. It also indirectly gives a glimpse into the process of getting this into Python through the exchanges during the Q&A discussion. One thing to especially highlight is that this copy-and-patch has a much, much lower implementation complexity for the maintainers, as a lot of the heavy lifting is offloaded to L
Cites acqq · 2023-12 · on “What's up Python? Epic CPython commit, Django 5 and 2FA for PyPI”
"Only 35% slower overall than LuaJIT" as per video from a month ago. No idea which kind of tests are these "overall" though. [this video] Slides (pg. 31 performance): [LINK]
Cites Qem · 2024-06 · on “Copy-and-Patch: Fast compilation for high-level languages and bytecode (2020)”
Yes. This is the algorithm chosen for the CPython JIT under development, scheduled for inclusion from 3.13 onwards. See [this video]