Oriel — AI & technology worth noticing, every day.

Adapting CPython for Yk

Web page · https://tratt.net/laurie/blog/2026/adapting_cpython_for_yk.html

First seen by Oriel on .

AI summary

The post documents adapting CPython for yk, showing that a small integration with its meta-tracing JIT can deliver meaningful benchmark gains over normal CPython and Python’s experimental JIT.

  • ykcpython beat CPython 3.15.1 on 12 of 13 AWFY benchmarks and beat its experimental JIT on 8 of 13.
  • The adaptation added just under 450 LoC; direct ykcpython work took 3–4 days after roughly a week and a half of generic yk bug fixes.
  • Opcode specialisation repeatedly invalidated tier 1 traces, so the author switched to CPython’s tier 2 interpreter, whose initial yk support required 80 LoC.
  • yk uses YkLocation to identify hot guest-language loops, traces the C interpreter, optimises those traces, and emits machine code using optional language-specific hints.
  • Results include startup and warm-up across ten in-process iterations, but ykcpython is not production-ready and broader workloads should not be expected to match these gains.

#cpython #yk #meta-tracing #jit compilers

Generated by gpt-5.6-sol. Check the original for details.

Metric trends

Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained

Points

Score reported by the source.

  • Hacker News: 79, latest observation ; +69 over observed period since
  • Lobsters: 24, latest observation ; +23 over observed period since

Comments

Comment count reported by the source.

  • Hacker News: 6, latest observation ; +6 over observed period since
  • Lobsters: 2, latest observation ; +2 over observed period since

Aliases

SourceExternal IDURL
Hacker News50466410https://tratt.net/laurie/blog/2026/adapting_cpython_for_yk.html Read discussion
Lobstersgejy85https://tratt.net/laurie/blog/2026/adapting_cpython_for_yk.html Read discussion