Skip to content
HHackerTube.videoSurprise me

Brandt Bucher – A JIT Compiler for CPython

Brandt Bucher – A JIT Compiler for CPython on HackerTube: recommended by 1 Hacker News commenter across 1 month, 2023–2024.

encukou

talk · advanced · dated

Open on YouTube

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.

Why Hacker News recommends it

It is the go-to explanation of how CPython's JIT works and why its design is so simple.

people recommended it
1
separate months
1
strong recommendations
1
discussed on HN
2023–2024
“I recommend that people watch Brandt Bucher's "A JIT Compiler for CPython" from last year's CPython Core Developer Sprint[0].”
— vanderZwan, Jan 2024, in “Python 3.13 Gets a JIT”

What HN commenters said

3 Hacker News comments link this video. Each one links back to its thread.

vanderZwanJan 2024Strongly recommends

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 LLVM. Case in point: as of the talk this was all just Brandt Bucher's work. The implementation at the time was ~700 lines of "complex" Python, ~100 lines of "complex" C, plus of course the LLVM dependency. This produces ~3000 lines of "simple" generated C, requires an additional ~300 lines of "simple" hand-written C to come together, and no further dependencies (so no LLVM necessary to run the JIT. Also "complex" and "simple" qualifiers are Bucher's terms, not mine). Another thing to note is that these initial performance improvements are just from getting this first version of the copy-and-patch JIT to work at all , without really doing any further fine-tuning or optimization. This may have changed a bit in the months since, but the situation is probably still comparable. So if one person

in “Python 3.13 Gets a JIT” · View on HN

QemJun 2024Cites it

Yes. This is the algorithm chosen for the CPython JIT under development, scheduled for inclusion from 3.13 onwards. See ▶ this video

in “Copy-and-Patch: Fast compilation for high-level languages and bytecode (2020)” · View on HN

acqqDec 2023Cites it

"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]

in “What's up Python? Epic CPython commit, Django 5 and 2FA for PyPI” · View on HN

Topics & tags