HackerTube.dev

Brandt Bucher – A JIT Compiler for CPython

encukou · 14.1K views · 2023-11-15 · 47:51

Open on YouTube ↗

If playback is restricted in your region, try opening the original video. Use Mark watched to add it to your marked videos.

Overview

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.

On Hacker News

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

Recommended by 1 HN people across 1 months · HN mentions 2023–2024

Topics

Search by tags

What people said

vanderZwan · 2024-01 · Strong recommendation

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

Read the original HN comment ↗
Qem · 2024-06 · Reference

Yes. This is the algorithm chosen for the CPython JIT under development, scheduled for inclusion from 3.13 onwards. See [VIDEO]

Read the original HN comment ↗
acqq · 2023-12 · Reference

"Only 35% slower overall than LuaJIT" as per video from a month ago. No idea which kind of tests are these "overall" though. [VIDEO] Slides (pg. 31 performance): [LINK]

Read the original HN comment ↗

Sources

Video by encukou, played through YouTube.

Data and selection notes

HN summaries and labels may contain AI errors. HN dates refer to discussions, not video publication.

HN Library: HackerTube export (2026-10-31) and open-index/hacker-news. Upstream summaries and classifications may contain AI errors.

Views, duration and playback status refresh separately from the published catalog. When an update fails, existing data remains visible.

Selection checks
  • SaaS & AI candidates: Topic keywords do not match
  • Editor-approved picks: Editorial review is required

Rule matches identify candidates. They do not guarantee video quality or financial results.

About the library and its sources