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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
420
ZJIT: The Future of Ruby Performance / San Francisco Ruby Conference 2025
k0kubun
1
79
ZJIT: Building a New JIT Compiler for Ruby / REBASE 2025
k0kubun
0
79
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
520
Why Ruby's JIT was slow / RubyKaigi Takeout 2021
k0kubun
3
2k
Other Decks in Programming
See All in Programming
AIとペアプロして処理時間を97%削減した話 #pyconshizu
kashewnuts
1
150
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
360
CopilotKit + AG-UIを学ぶ
nearme_tech
PRO
1
110
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
1
250
日本だけで解禁されているアプリ起動の方法
ryunakayama
0
360
文字コードの話
qnighy
41
16k
AWS re:Invent 2025参加 直前 Seattle-Tacoma Airport(SEA)におけるハードウェア紛失インシデントLT
tetutetu214
2
130
TROCCOで実現するkintone+BigQueryによるオペレーション改善
ssxota
0
110
ふん…おもしれぇ Parser。RubyKaigi 行ってやるぜ
aki_pin0
0
110
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
5
890
モジュラモノリスにおける境界をGoのinternalパッケージで守る
magavel
0
2.9k
AI活用のコスパを最大化する方法
ochtum
0
110
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Exploring anti-patterns in Rails
aemeredith
2
280
New Earth Scene 8
popppiees
1
1.6k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.1k
It's Worth the Effort
3n
188
29k
What's in a price? How to price your products and services
michaelherold
247
13k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
370
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
850
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
0
2.4k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
BBQ
matthewcrist
89
10k
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