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
74
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
More Decks by Jason Hou
See All by Jason Hou
how ruby uses memory and tuning
falm
0
100
Other Decks in Programming
See All in Programming
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
200
最近”作らせてる” ローカルAIアプリの話
akit37
0
470
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.9k
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
コーディング自動化の次へ。人の介入をゼロにするファクトリーとサポートAIによる実践
timakin
4
3.5k
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
380
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
430
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
350
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
270
ChromeでローカルLLM
ryu1013
0
140
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
170
気持ちぃ〜角丸 Squircle
ryu1013
0
310
Featured
See All Featured
Designing for Performance
lara
612
70k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
How to Talk to Developers About Accessibility
jct
2
580
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
620
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Docker and Python
trallard
47
4.2k
GraphQLとの向き合い方2022年版
quramy
50
15k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.7k
[SF Ruby Conf 2025] Rails X
palkan
3
1.5k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
77k
The browser strikes back
jonoalderson
0
1.8k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
410
Transcript
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