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
4.8k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Deoptimization: How YJIT Speeds Up Ruby by Slowing Down / RubyKaigi 2025
https://rubykaigi.org/2025
Takashi Kokubun
April 16, 2025
More Decks by Takashi Kokubun
See All by Takashi Kokubun
Lightning-Fast Method Calls with Ruby 4.1 ZJIT / RubyKaigi 2026
k0kubun
3
3.8k
一度始めたらやめられない開発効率向上術 / Findy あなたのdotfilesを教えて!
k0kubun
4
3.2k
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
560
ZJIT: The Future of Ruby Performance / San Francisco Ruby Conference 2025
k0kubun
1
150
ZJIT: Building a New JIT Compiler for Ruby / REBASE 2025
k0kubun
0
160
YJIT Makes Rails 1.7x faster / RubyKaigi 2024
k0kubun
7
16k
Ruby JIT Hacking Guide / RubyKaigi 2023
k0kubun
2
11k
YJIT: Dive into Ruby's JIT compiler written in Rust / Rust.Tokyo 2022
k0kubun
2
2.4k
Towards Ruby 4 JIT / RubyKaigi 2022
k0kubun
3
12k
Other Decks in Programming
See All in Programming
30年振りにコンパイラの定数整数除算を改善した
herumi
9
4.4k
[PyCon KR 2026] More Variants, More Diversity for AI Accelerators
achimnol
0
130
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
1.6k
Foundry Localでエージェント開発
seosoft
0
110
Hello, Hiroshima Geospatial Data! — Exploring DoboX with Python
ra0kley
0
160
レビュー履歴をAIに食わせて、 Compose移行を加速するs
shihochan
0
260
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
490
Seeing Through Serverless: Observability for AWS Lambda with ADOT and CloudWatch Application Signals
seike460
PRO
1
110
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
770
楽しそうなつよつよエンジニアと目が死んでる僕/A brilliant engineer having a blast, and dead-eyed me.
3l4l5
2
280
自分的「カンファレンスの楽しみ方」
syumai
0
180
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
4.2k
Featured
See All Featured
Writing Fast Ruby
sferik
630
63k
Statistics for Hackers
jakevdp
799
230k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.7k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
510
The Limits of Empathy - UXLibs8
cassininazir
1
630
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
230
4 Signs Your Business is Dying
shpigford
187
23k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
410
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Documentation Writing (for coders)
carmenintech
77
5.5k
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