Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Deoptimization: How YJIT Speeds Up Ruby by Slow...
Search
Takashi Kokubun
April 16, 2025
Programming
2
3.9k
Deoptimization: How YJIT Speeds Up Ruby by Slowing Down / RubyKaigi 2025
https://rubykaigi.org/2025
Takashi Kokubun
April 16, 2025
Tweet
Share
More Decks by Takashi Kokubun
See All by Takashi Kokubun
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
430
ZJIT: The Future of Ruby Performance / San Francisco Ruby Conference 2025
k0kubun
1
87
ZJIT: Building a New JIT Compiler for Ruby / REBASE 2025
k0kubun
0
84
YJIT Makes Rails 1.7x faster / RubyKaigi 2024
k0kubun
7
15k
Ruby JIT Hacking Guide / RubyKaigi 2023
k0kubun
2
10k
YJIT: Dive into Ruby's JIT compiler written in Rust / Rust.Tokyo 2022
k0kubun
2
2.3k
Towards Ruby 4 JIT / RubyKaigi 2022
k0kubun
3
12k
Optimizing Production Performance with MRI JIT / RubyConf 2021
k0kubun
1
530
Why Ruby's JIT was slow / RubyKaigi Takeout 2021
k0kubun
3
2k
Other Decks in Programming
See All in Programming
GC言語のWasm化とComponent Modelサポートの実践と課題 - Scalaの場合
tanishiking
0
110
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
190
米国のサイバーセキュリティタイムラインと見る Goの暗号パッケージの進化
tomtwinkle
2
550
「抽象に依存せよ」が分からなかった新卒1年目の私が Goのインターフェースと和解するまで
kurogenki
0
110
Vuetify 3 → 4 何が変わった?差分と移行ポイント10分まとめ
koukimiura
0
120
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1k
DSPy入門 Pythonで実現する自動プロンプト最適化 〜人手によるプロンプト調整からの卒業〜
seaturt1e
1
680
ふつうの Rubyist、ちいさなデバイス、大きな一年
bash0c7
0
830
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
1k
grapheme_strrev関数が採択されました(あと雑感)
youkidearitai
PRO
1
210
CSC307 Lecture 15
javiergs
PRO
0
240
Ruby and LLM Ecosystem 2nd
koic
1
540
Featured
See All Featured
Everyday Curiosity
cassininazir
0
160
The Pragmatic Product Professional
lauravandoore
37
7.2k
Optimizing for Happiness
mojombo
378
71k
The Curious Case for Waylosing
cassininazir
0
270
How to train your dragon (web standard)
notwaldorf
97
6.6k
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
62
51k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.1k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
84
The Limits of Empathy - UXLibs8
cassininazir
1
250
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.1k
Bash Introduction
62gerente
615
210k
Transcript
Deoptimization: How YJIT Speeds Up Ruby by Slowing Down @k0kubun
/ RubyKaigi 2025
@k0kubun
@k0kubun Z
None
We’re hiring https://candidate.shopify.com/form/ruby-kaigi-2025
None
YJIT
None
https://railsatscale.com/2025-01-10-yjit-3-4-even-faster-and-more-memory-ef fi cient/
None
None
Deoptimization
None
Deoptimization What if you can “slow down” Ruby at any
time? You can speculatively optimize Ruby and invalidate it later
Playing with Deoptimization Build Ruby with: ./con fi gure --enable-yjit=dev
Run Ruby with: ruby --yjit-call-threshold=1 --yjit-dump-disasm
Playing with Deoptimization
None
YJIT Deoptimization
Code Patching
None
None
None
None
Rewrite
Rewrite Jump
Global Invalidation
None
None
None
Ruby 3.4’s New YJIT Deoptimization
Invalidation on Escaped Locals
?
None
None
Invalidation on Singleton Classes
None
None
None
None
Singleton Class Invalidation
Lazy Frame Push
None
None
None
Lazy Frame Push
None
None
None
None
YJIT-only Ruby Methods
Array#each
None
None
None
None
None
None
None
Primitive.attr! :c_trace
Conclusion Deoptimization enables speculative optimizations with lazy invalidation Ruby 3.4
YJIT optimizes method calls and local variables using deoptimization