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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
88
ZJIT: Building a New JIT Compiler for Ruby / REBASE 2025
k0kubun
0
86
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
Unity6.3 AudioUpdate
cova8bitdots
0
130
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.9k
メタプログラミングで実現する「コードを仕様にする」仕組み/nikkei-tech-talk43
nikkei_engineer_recruiting
0
190
Ruby and LLM Ecosystem 2nd
koic
1
860
Swift ConcurrencyでよりSwiftyに
yuukiw00w
0
270
文字コードの話
qnighy
44
17k
OTP を自動で入力する裏技
megabitsenmzq
0
110
米国のサイバーセキュリティタイムラインと見る Goの暗号パッケージの進化
tomtwinkle
2
590
2026年は Rust 置き換えが流行る! / 20260220-niigata-5min-tech
girigiribauer
0
240
LangChain4jとは一味違うLangChain4j-CDI
kazumura
1
190
AHC061解説
shun_pi
0
380
SourceGeneratorのマーカー属性問題について
htkym
0
200
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.5k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
From π to Pie charts
rasagy
0
150
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
770
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
100
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
ラッコキーワード サービス紹介資料
rakko
1
2.6M
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
480
Ruling the World: When Life Gets Gamed
codingconduct
0
180
My Coaching Mixtape
mlcsv
0
74
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
150
Designing Experiences People Love
moore
143
24k
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