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.8k
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
400
ZJIT: The Future of Ruby Performance / San Francisco Ruby Conference 2025
k0kubun
1
65
ZJIT: Building a New JIT Compiler for Ruby / REBASE 2025
k0kubun
0
70
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.2k
Towards Ruby 4 JIT / RubyKaigi 2022
k0kubun
3
12k
Optimizing Production Performance with MRI JIT / RubyConf 2021
k0kubun
1
520
Why Ruby's JIT was slow / RubyKaigi Takeout 2021
k0kubun
3
2k
Other Decks in Programming
See All in Programming
AtCoder Conference 2025
shindannin
0
1k
CSC307 Lecture 06
javiergs
PRO
0
680
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
200
CSC307 Lecture 03
javiergs
PRO
1
490
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
120
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
440
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
170
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
540
Oxlint JS plugins
kazupon
1
550
CSC307 Lecture 07
javiergs
PRO
0
550
今こそ知るべき耐量子計算機暗号(PQC)入門 / PQC: What You Need to Know Now
mackey0225
3
370
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
46
8k
Automating Front-end Workflow
addyosmani
1371
200k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
160
Balancing Empowerment & Direction
lara
5
880
Leo the Paperboy
mayatellez
4
1.4k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
0
310
Making Projects Easy
brettharned
120
6.6k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
170
The browser strikes back
jonoalderson
0
360
Un-Boring Meetings
codingconduct
0
200
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.2k
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