Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
introduce Ruby JIT -- the force awakens
Search
Jason Hou
March 24, 2018
Programming
78
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
introduce Ruby JIT -- the force awakens
Shanghai RubyTuesday
Jason Hou
March 24, 2018
Transcript
30 slides
Ruby JiT THE force awakens 侯俊杰@falm - 薄荷 2018.3.20
CRuby / MRI
克隆人的进攻 • JRuby • TruffleRuby • Crystal • Elixir
Ruby 3 • Typing • Concurrency • Performance Soft-typing Guilds
JIT
JIT 即时编译
PyPy 2 Python 3
MRI
Ruby JIT的历程 yarv2llvm RuJIT OMR JIT LLRB 2015 2011 2017
active
None
RTL-MJIT 新希望
RTL-MJIT • 作者:Vladimir Makarov • RTL: Register Transfer Language⽤用寄存器器VM, 代替YARV的栈VM
• MJIT : Method JIT compiler,MRI JIT
栈 VS 寄存器
YARV puts 2+2 指令 求值栈
寄存器式 trace putself opt_plus r0, 2, 2 opt_send_simple <puts> leave
指令 寄存器器 r0 r1 4 puts 2+2 PC
栈式 VS 寄存器器式 对⽐比 指令条数 栈式 > 寄存器器式 代码尺⼨寸 栈式
< 寄存器器式 移植性 栈式优于寄存器器式 指令优化 栈式更更不不易易优化 解释器器执⾏行行速度 栈式解释器器速度稍慢 代码⽣生成难度 栈式简单 简易易实现中的数据移动次数 栈式移动次数多
MJIT MRI VM Thread worker thread MJIT JIT worker worker
thread worker thread 预编译头 C 代码 动态链接库 header building execution
Optcarrot fps FPS 0 22.5 45 67.5 90 v2.0 base(v2.5)
rtl mjit mjit-cl 85.43 82.06 35.75 39.71 29.02 Intel 3.9GHz i3-7100 with 32GB memory under x86-64 Fedora Core25 1.0x 1.37x 1.23x 2.83x 2.94x
• 优点:速度快,是目前优化速度最快的JIT,并且 内存消耗控制的也比较好 • 缺点:结构复杂,需要整体替换Ruby VM,改动 非常多,目前还无法跑通回归测试。
None
None
YARV-MJIT 原力觉醒
YARV-MJIT • 作者 Takashi Kokubun • 基于RTL-MJIT的基础上去掉RTL的使用原生YARV • 同样Method-based JIT
• VM-generated JIT 编译器
None
Optcarrot fps FPS 0 15 30 45 60 v2.0 v2.6
v2.6 jit off v2.6 jit on 58.88 51.31 51.46 37.32 1.00x 1.38x 1.37x 1.58x Intel 4.0GHz i7-4790K with 16GB memory under x86-64 Ubuntu 8 Cores
• 优点:简单,已经跑通所有测试 • 缺点:并非ruby3x3最终方案,性能提升不显著。
Ruby 2.6 JIT 编译器:YARV-JIT 基础设施:MJIT
总结 • Ruby在JIT上做了了很多尝试。 • MJIT 目前是性能最好的方案,获得Matz的认可。 • Ruby2.6JIT虽不是最终方案,但向前迈出了重要 一步。 •
Ruby 社区仍在为性能做出努力。
Ruby 3x3 绝地反击
THANKS
https://ruby-china.org/topics/35131
More Decks by Jason Hou
See All by Jason Hou
how ruby uses memory and tuning
falm
0
110
Other Decks in Programming
See All in Programming
AI時代のIaC入門 〜なぜインフラをコードで管理したいのか?〜 / Introduction to IaC in the AI Era
akihisaikeda
6
1.6k
Secure Your Coding Agent Like It’s Malware (v1.5) 🇬🇧 @Code.talks 2026
richargh
0
210
Growing PicoRuby's Ecosystem on ESP32
yuuu
2
150
ruby/uri meets WHATWG
jinroq
0
170
Apache Airflow Introduction
leew
1
100
AIが実装を担う時代の「技術設計」と「チームマネジメント」
kamina_zzz
2
470
特急いなほ as a Workflow / 20261107jaws-festa-2026-akita-lt
kasacchiful
PRO
0
110
マルチプロダクトSaaSの アプリ一覧を速くする——複数プロダクトにまたがる「権限行脚」を減らすまで #techramen26conf
mktakuya
1
260
手の動かし方がわからなかった私が個人開発者になるまで
usagi0920_pochi
0
350
なぜ私たちは「現時点では」KMPの導入を見送ったのか
chigichan24
1
650
テストだけで見つかる? Rubyでつくるメソッド発掘器
izawa
0
170
読みやすい!と評判(?)の発表の準備にかける私のこだわり
shoheimitani
0
170
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
55
13k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Typedesign – Prime Four
hannesfritz
42
3.2k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
850
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
61k
Are puppies a ranking factor?
jonoalderson
2
4.2k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
480
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Amusing Abliteration
ianozsvald
1
400
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
1k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
620
The agentic SEO stack - context over prompts
schlessera
0
1k