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
JITコンパイラはいかにRailsを速くするか / Rails Developers Meet...
Search
Takashi Kokubun
December 09, 2017
Programming
4
4.3k
JITコンパイラはいかにRailsを速くするか / Rails Developers Meetup 2017
Rails Developers Meetup 2017 / k0kubun
Takashi Kokubun
December 09, 2017
Tweet
Share
More Decks by Takashi Kokubun
See All by Takashi Kokubun
YJIT Makes Rails 1.7x faster / RubyKaigi 2024
k0kubun
7
12k
Ruby JIT Hacking Guide / RubyKaigi 2023
k0kubun
2
9.4k
YJIT: Dive into Ruby's JIT compiler written in Rust / Rust.Tokyo 2022
k0kubun
1
2k
Towards Ruby 4 JIT / RubyKaigi 2022
k0kubun
3
11k
Optimizing Production Performance with MRI JIT / RubyConf 2021
k0kubun
1
410
Why Ruby's JIT was slow / RubyKaigi Takeout 2021
k0kubun
3
1.8k
数時間かかる週一リリースを毎日何度も爆速でできるようにするまで / CI/CD Conference 2021
k0kubun
21
14k
Ruby 3 JIT's roadmap / RubyConf China 2020
k0kubun
0
760
Ruby 3.0 JIT on Rails
k0kubun
9
9.1k
Other Decks in Programming
See All in Programming
Micro Frontends Unmasked Opportunities, Challenges, Alternatives
manfredsteyer
PRO
0
100
ヤプリ新卒SREの オンボーディング
masaki12
0
130
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.2k
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
3
690
距離関数を極める! / SESSIONS 2024
gam0022
0
280
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
300
イベント駆動で成長して委員会
happymana
1
330
Remix on Hono on Cloudflare Workers
yusukebe
1
300
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
250
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
役立つログに取り組もう
irof
28
9.6k
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
32
1.5k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Six Lessons from altMBA
skipperchong
27
3.5k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
900
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
How GitHub (no longer) Works
holman
310
140k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Transcript
JITίϯύΠϥ͍͔ʹ RAILSΛ͘͢Δ͔ RAILS DEVELOPERS MEETUP 2017
self #=> • @k0kubun • TreasureDataॴଐ • Rubyίϛολ • Hamlitͷ࡞ऀɺERBͱHamlͷϝϯςφ
• barbeque, mitamae, xremapΑΖ͘͠
࠷ۙRubyʹ͍Εͨػೳͷએ (Feature#14124) • binding.pry Έ͍ͨʹ binding.irb ͨ࣌͠ʹपลίʔυ͕දࣔ͞ΕΔΑ͏ʹͳΔ • ͜Ε͕͋ͬͯॳΊͯbinding.irbͨ͠ͱݴͬͯաݴͰͳ͍(?) •
ଞʹRuby 2.5ͰͳΜͱ require "irb" ͠ͳͯࣗ͘ಈͰϩʔυ͞ΕΔΑ͏ʹͳΓɺ binding.irb ͕ศརʹͳΔ
None
ಥવͰ͕͢ɺTDͰಇ͖͍ͨ ํ͍·ͤΜ͔ʁ
օ͞Μ͕ԿނTDʹԠื͠ͳ͍ͷ͔ෆ໌ • ࢄDBΫϥυͷཪଆΛݟΒΕΔɺ։ൃ͕Ͱ͖Δ • ༷ʑͳͷ༏लͳಉ྅ͱҰॹʹࣄ͕Ͱ͖Δ • Fluentd, Embulk, DigdagOSS։ൃ͕ࣄʹͰ͖Δ •
γϦίϯόϨʔग़ࢿͷ۰ɺۈ࣌ؒͷࣗ༝ߴ͍
RailsͰग़དྷ͍ͯΔίϯϙʔωϯτୡ • ϓϩμΫτ • Treasure Data Service • Customer Data
Platform • Enterprise Fluentd Management Console • ϚΠΫϩαʔϏε • Embulk config management API
Treasure Data Service ͷνʔϜ • kamipo (ϦϞʔτ) • ϑΣϧφϯυ (US,
ϦϞʔτ) • uu59 • k0kubun • makimoto
k0kubunͱJIT ͜Ε·Ͱͷ͋Β͢͡
20174݄: ͬͱ͍Rubyཉ͠ ͍ͳ… → JIT͚ͩॻ͚Αͦ͞͏
20174-6݄: C++ͱLLVMΛษڧ͠ͳ͕Βɺ CRuby͚ͷελοΫϕʔεͷϝιουJITΛ ։ൃ
20177݄: ຊମͷϚʔδΛເݟ ͯCʹॻ͖͠ "LLRB" ͱͯ͠ެ։
20177-8݄: MJIT͕ຊମʹೖΓͦ͏ͩ͠ LLRB͍͍͔ͱ͍͏ؾ࣋ͪʹͳΓɺGraphQL Ͱ༡ΜͰ͍ͨ
20179݄: RubyKaigiͰͷϨδελϕʔεͷϝ ιουJIT "MJIT" ͷൃදޙɺϦεΫΛऔΒͣε λοΫϕʔεͷ··Ͱ͍JITΛ࡞Δ͜ͱΛܾҙ
201710݄: MJITͷ͏ͪJITίʔυੜ෦͚ͩஔ ͖͑ͨ "YARV-MJIT" Λ։ൃɺެ։ (optcarrot: YARV-MJIT/gcc 56.4, MJIT/gcc 75.6)
201711݄: RubyConfʹ͚YARV-MJITߴ ԽɺpthreadҠ২ɺWindowsରԠ (optcarrot: YARV-MJIT/gcc 69.4, MJIT/gcc 75.6)
201712݄: railsdm2017 ͰJIT͕RailsʹͲΕ͘ Β͍ޮՌ͕͋Δ͔͢༧ఆ͕ͩͬͨɺYARV-MJIT ΛRailsͰಈ͔͠ଓ͚ΔͱյΕΔ͜ͱʹؾ͘
201712݄: RailsͰಈ͘Α͏ʹ͘͢Ұࡢ͔ ΒYARV-MJITͷج൫ͷॻ͖͠Λ࢝Ίɺͦͷϒ ϥϯνͰΑΓ҆ఆͯ͠ಈ͘Α͏ʹͳͬͨ
͔͠͠RailsͰಈ͔ͯ͠Δͱ ͬͺ͍͔ͭյΕΔ
ͳͷͰࠓ͜͏͍͏Λ͠·͢ • CRuby͚ͷJITͷݱঢ় • Ͳͷ͘Β͍Rails͕ಈ͔ͤΔͷ͔ • ϕϯνϚʔΫ݁Ռ • YARV-MJIT͕ߦͳ͏࠷దԽͷΈ •
ͦΕͧΕͷRailsͷΠϯύΫτͷ༧ • RailsͰͷYARV-MJITͷ͍ํ
CRuby͚ͷJITͷݱঢ়
CRuby͚ͷJITͨͪ • RuJIT: TraceϕʔεɺϝϞϦ༻ྔ͕ʹͳ༷ͬͨ • Eclipse OMR: Optcarrotͩͱ͘ͳΒͳ͍Β͍͠ • LLRB:
LLVMਏ͍ɺͪ͜Β͔ΒҎ্ • MJIT: ͍ɺগͳ͍ϝϞϦফඅɺมͳґଘͳ͍ • YARV-MJIT: ͪΐͬͱMJITΑΓ͍͕ɺVMଆ͕όάΒͳ͍
ࠓMJIT, YARV-MJITͷ͚ͩ͠·͢ • RuJIT: TraceϕʔεɺϝϞϦ༻ྔ͕ʹͳ༷ͬͨ • Eclipse OMR: Optcarrotͩͱ͘ͳΒͳ͍Β͍͠ •
LLRB: LLVMਏ͍ɺͪ͜Β͔ΒҎ্ • MJIT: ͍ɺগͳ͍ϝϞϦফඅɺมͳґଘͳ͍ • YARV-MJIT: ͪΐͬͱMJITΑΓ͍͕ɺVMଆ͕όάΒͳ͍
MJITͱ • GitHub: vnmakarov/ruby • CRubyͷͨΊͷϝιουJITίϯύΠϥ • JITίϯύΠϥ͚ͩͰͳ͘ɺϕʔεͷVM໋ྩஔ͖͑ • JIT༻pthread͕gccclangΛfork,
execͯ͠dlopen, dlsym • ͜ͷͨΊWindowsͰಈ͔ͳ͍ • http://rubykaigi.org/2017/presentations/vnmakarov.html
YARV-MJITͱ • GitHub: k0kubun/yarv-mjit • MJITΛΑΓอकతʹͨ͠ϑΥʔΫ, trunkʹैத • JITج൫Λվળͭͭ͠ɺVM໋ྩஔ͖͑ͳ͍ •
MJITʹগ͠ྼΔ͕ɺRuby 2.5ΑΓेߴ • pthread෦ΛWindows͚ʹҠ২ࡁɺMinGWͰશʹಈ࡞
ԿނYARV-MJITΛ։ൃ͍ͯ͠Δͷ͔ • RubyΛόάͳ͘ϦϦʔε͍ͯͨ͘͠Ίʹɺ͍͖ͳΓMJITΛೖΕΔͷͦ͠͏ • VM໋ྩͷஔ͖͑ϦεΩʔ (YARV͕ೖͬͨRuby 1.9࠷ॳ͔ͳΓյΕ͍༷ͯͨ) • JITΦϓγϣφϧͳͷͰࢼݧతʹಋೖ͍͕͢͠ɺVMͷมߋόάΔͱճආͰ͖ͳ͍ •
ͦΕͱಉ࣌ʹҠ২ੑΛղܾ͠ͳ͕ΒJITج൫ಋೖ͢Δඞཁ͕͋Δ • VMͦͷ··Ͱಈ͘γϯϓϧͳJIT (YARV-MJIT) ΛͱΓ͋͑ͣೖΕͯΈͨΒͲ͏͔ • ෦తʹupstreamʹ͋ΔͱMJIT͕ίϯϑϦΫτ͠ʹ͘͘ͳΓɺڞ༗͍ͯ͠ΔJITج൫ڠ ྗͯ͠։ൃ͘͢͠ͳΔ
ͰɺRailsͰಈ͘ΜͰ͔͢ʁ
ͦͦRubyຊମͷςετ͕ͲͪΒશ෦௨Βͳ͍ .+*5 :"37.+*5 NBLFUFTUUFTUBMMTQFD XJUIPVU+*5 ˓ºº ˓˓˓ NBLFUFTUUFTUBMMTQFD XJUI+*5 ˓ºº
ºº˓
MJIT on Rails • MJIT͕ϕʔεʹ͍ͯ͠ΔRTL໋ྩͷVMͰffi͕ಈ͔ͳ͍ • rubyͷtest-allͱ͔rubyspecམͪΔ • ͳͷͰJIT͕༗ޮ͔Ͳ͏͔ʹؔΘΒͣɺݱঢ়Railsىಈෆೳ •
ͨͩ͠ɺVladimirRTLΛYARV→JIT࣌ͷதؒදݱʹมߋதΒ͍͠ͷͰղܾ͞ΕΔ͔ ͠Εͳ͍͕ɺະެ։ͷͨΊෆ໌
YARV-MJIT on Rails • VMʹ΄΅ϊʔλονͳͷͰJIT͕ແޮͷঢ়ଶͰRailsͩΖ͏͕શʹಈ࡞͢Δ • JIT༗ޮͩͱଟ͓͔͍͠ίϯύΠϧΛ͍ͯ͠Δͷ͕͍͔͋ͬͯͭམͪΔ • Ϛʔδ͢Δʹͯ͜͠Εղܾ͔ͯ͠ΒͰ͠ΐ͏Ͷ
ϕϯνϚʔΫ݁Ռ
Ruby 3x3 ͷ֬ೝʹΘΕ͍ͯΔϕϯνϚʔΫ • mame/optcarrot • Rubyίϛολͷԕ౻͞Μ࡞ NESΤϛϡϨʔλͷϕϯν • noahgibbs/rails_ruby_bench
• Noah GibbsʹΑΔ RailsΞϓϦdiscourseΛͬͨϕϯν
mame/optcarrot 0QUDBSSPUXJUI
[email protected]
GQT Ruby 2.0
Ruby 2.5 YARV-MJIT MJIT
noahgibbs/rails_ruby_bench • MJIT, YARV-MJIT ͕RailsͰಈ͔͘Ͳ͏͔Ҏલʹ͜ͷϕϯνϚʔΫͷ࣮ߦ͕͍͠ • RubyͱRailsͷίϛολʔͷদా͞Μಈ͔ͤͳ͔ͬͨ͠ɺಈ͔ͤͳ͔ͬͨ • ͳͷͰɺࠓͪΐͬͱࣗͰRailsͷϕϯνϚʔΫΛॻ͖࢝Ί͍ͯΔ
Ruby Grant 2017ͷϕϯν ϚʔΫϓϩδΣΫτʹ͍ͭͯ
Ruby Grant 2017ͬͯ·͢ • Ruby Grant ͱ: 50ສԁΛ͍͍ͨͩͯRubyʹߩݙ͢Δౕ • ϕϯνϚʔΫڥͷඋΛ͍ͬͯ·͢
• benchmark_driver.gem • ैདྷͷϕϯνϚʔΧʔʹଘࡏ͢ΔProcݺͼग़͠ͷΦʔόʔϔου͕ͳͤ͘Δ • ϝϞϦ༻ྔΛܭଌͨ͠ΓɺΞτϓοτΛϓϥάΠϯͰࣗ༝ʹม͑ͨΓ • ͋ͱͦΕΛͬͯϕϯνϚʔΫηοτͷ֦ॆͱɺCIڥΛ༻ҙ͠·͢ • ࠷ऴతʹRubyBenchͷ߹ྲྀࢹ
ϕϯνϚʔΫηοτͷ֦ॆʹ͍ͭͯ • RubyͷίΞΫϥεͷϝιουͷΧόϨοδΛ্͍͛ͯ͘ • Railsͱ͔Fluentdͱ͔ͷϕϯνϚʔΫॻ͜͏ͱࢥ͍ͬͯΔ • RailsΓ࢝Ίͨ: https://github.com/benchmark-driver/rails-benchmarks • ActionViewͷϕϯνॻ͍ͯͨͱࢥͬͨΒςϯϓϨʔτΤϯδϯΛϕϯν͍ͯͨ͠
YARV-MJITͷ࠷దԽͷΈ
YARV-MJITͷ࠷దԽͷΈ QVUPCKFDU QVUPCKFDU PQU@NVMU MFBWF $BMMDPVOU :"37CZUFDPEF 5ISFBE3VCZ7. 5ISFBE+*5DPNQJMFS *OUFSQSFU
YARV-MJITͷ࠷దԽͷΈ QVUPCKFDU QVUPCKFDU PQU@NVMU MFBWF $BMMDPVOU 7"-6&PQU@NVMU B C \
*G OPU@SFEFpOFE JOU@NVMU \ SFUVSOB C ^FMTF\ SFUVSOWN@FYFD ^ ^ 7"-6&OBUJWF@DPEF \ SFUVSOPQU@NVMU ^ $DPNQJMFS 0QUJNJ[F$PNQJMF :"37CZUFDPEF 5ISFBE3VCZ7. 5ISFBE+*5DPNQJMFS (FOFSBUF$DPEF *OUFSQSFU
YARV-MJITͷ࠷దԽͷΈ #ZUFDPEF GPS3VCZ7. QVUPCKFDU QVUPCKFDU PQU@NVMU MFBWF $BMMDPVOU 40pMF 7"-6&OBUJWF@DPEF
\ *G OPU@SFEFpOFE JOU@NVMU \ SFUVSO ^FMTF\ SFUVSOWN@FYFD ^ ^ $BMM $DPNQJMFS 5ISFBE3VCZ7. 5ISFBE+*5DPNQJMFS *OUFSQSFU (FOFSBUF$DPEF EMTZN /BUJWFDPEF
͜ͷݩͷੜίʔυΛݡ͘͠ͳ͍ͱ͘ͳΒͳ͍ͷͰɺͦͷ #ZUFDPEF GPS3VCZ7. QVUPCKFDU QVUPCKFDU PQU@NVMU MFBWF $BMMDPVOU 40pMF 7"-6&OBUJWF@DPEF
\ *G OPU@SFEFpOFE JOU@NVMU \ SFUVSO ^FMTF\ SFUVSOWN@FYFD ^ ^ $BMM $DPNQJMFS 5ISFBE3VCZ7. 5ISFBE+*5DPNQJMFS *OUFSQSFU (FOFSBUF$DPEF EMTZN /BUJWFDPEF
JITίʔυͷ࠷దԽઓུ
JITίʔυͷ࠷దԽઓུ • ͕RubyKaigi 2017ͷΩʔϊʔτʹٻΊ͍͚ͯͨͲ͞Εͳ͔ͬͨ෦ • MJITͱYARV-MJITͷίϯύΠϥผ͕ͩɺ͞ͷຊ࣭తͳཧ༝ଟ͘ڞ༗͍ͯ͠Δ • MJIT͕͍ཧ༝ϕʔεͷ໋ྩ͕Ϩδελϕʔε͔ͩΒͰͳ͍ͱࢥ͍ͬͯΔ • ͜ΕҎ߱ͷ༰ͰͦΕΛূ໌
جຊΞΠσΞ • ݱࡏओʹҎԼͷ3छྨͷ࠷దԽʹϑΥʔΧε: • ؔͷΠϯϥΠϯԽ • ෆཁॲཧͷলུ • ίϯύΠϧ࣌ؒͷॖ •
ͦΕͧΕRailsʹޮՌ͕͋Γͦ͏͔ߟΛ͍Ε·͢ • ͠શ෦ޮՌ͋ΔͳΒɺRailsͷRubyͷϨΠϠʔ͕ಉ͘͡Β͍͘ͳΔͣ
ઓུ1: VMͷίʔυΛͳΔ͘ϔομʹؚΊΠϯϥΠϯԽ͢Δ • ର: ؔͷΠϯϥΠϯԽ (MJIT͔ΒͷҠ২) • ίϯύΠϥίϯύΠϥʹ͞Εͨίʔυ͔͠࠷దԽͰ͖ͳ͍ͷͰɺఆٛΛ͢ • ୯ʹ
vm.c ΛϓϦϓϩηεͨ͠ͷΛϔομͱͯ͠Πϯετʔϧ • Railsʹޮ͔͘: ◦ • VM࣮ߦ໋ྩΛލ͍ͩ࠷దԽ͕Ͱ͖ͳ͍ͷͰɺେମ͋ΔఔޮՌ͕͋Δ • ͨͩ͠ɺಛԽ໋ྩͷ͋ΔҰ෦ͷϝιου࠶ఆٛ͞Ε͍ͯͳ͍߹ʹྑ͘ޮ͘ͷͰɺASͷ ͍ͤͰ͘ͳΔౕ͋Δ͔
ઓུ2: ϔομͷඇstaticؔΛstaticʹ͢Δ • ର: ίϯύΠϧ࣌ؒͷॖ (MJIT͔ΒͷҠ২) • ະ༻ͷstaticؔී௨ͷ -O2 ͳΒίϯύΠϧ͕ແࢹ͞ΕΔ͜ͱΛར༻
• RubyͷεΫϦϓτ͕CͷίʔυΛਖ਼نදݱͰؾ߹Ͱม (!?) • Railsʹޮ͔͘: ˕ • ίϯύΠϧ͕͍࣌ؒํ͕ͨ͘͞ΜίϯύΠϧͰ͖ΔͷͰɺ࣮֬ʹޮ͘
ઓུ3: setjmpݺͼग़͠ΛεΩοϓͨ͠JITίʔυݺͼग़͠ • ର: ෆཁॲཧͷলུ (MJIT͔ΒͷҠ২) • Rubyͷྫ֎"setjmp", “longjmp"Ͱ࣮͞Ε͍ͯΔ͕ɺϚγϯͷίϯςΩετͷอଘ͕ඞཁͰ ͍
• ͜Ε͕ඞཁͳέʔεͷͨΊɺجຊతʹJITίʔυVMΛىಈ͢Δؔʹϥοϓͯ͠ݺͼग़͍ͯ͠ Δ • ྫ֎͕ग़ͳͦ͏ͳόΠτίʔυͷ߹ʹɺͦͷϥοϓΛεΩοϓ͢Δ • Railsʹޮ͔͘: ◦ • ΞϓϦͰྫ֎Λ͏ʹͯ͠RailsͷϨΠϠʔͰޮ͘ॴ͋Δఔ͋Γͦ͏
ઓུ4: ࠷దԽʹ࣌ؒͷ͔͔ΔؔͷΠϯϥΠϯԽΛආ͚Δ • ର: ίϯύΠϧ࣌ؒͷॖ (MJIT͔ΒͷҠ২) • CͷίʔυͷίϯύΠϧ࣌ؒɺύʔεͱ͔ڱٛͷίϯύΠϧҰॠͰɺ࠷దԽ͕͍ • ͳͷͰɺ࠷దԽ͕େมͳౕΛexternͰࢀর͢ΔΑ͏ʹ͢ΕίϯύΠϧ͘ͳΔ
• େมͳౕ: vm_search_method (ϝιου୳ࡧ) • ݺͼग़͢ͷ͕ඞཁͳ߹VM࣮ߦʹdeoptimizationΛ͢Δ • Railsʹޮ͔͘: ˚ • ͜ΕτϨʔυΦϑͷ͋Δ࠷దԽͰɺ͔ͳΓ͍࣌ؒΒͤΔRailsʹඍົͰ͢Ͷ
ઓུ5: ڥϙΠϯλͷॳظͷอଘ • ର: ෆཁॲཧͷলུ (MJIT͔ΒͷҠ২) • ͔ͳΓ͜Έ͍ͬͨͳͷͰฉ͖ྲྀ͍ͯͩ͘͠͞ (ͰޮՌ͋Δ) •
YARVڥϙΠϯλ(ep)ͱελοΫϙΠϯλ(sp)Λ࣋ͪɺͦΕΒ࠷ॳಉ͡ • deoptimization࣌spͷૢ࡞͕ཁΔ͕ɺϝιουͰProcੜͳͲͰڥ͕࡞ΒΕͨ࣌epಈ͍ͯ͠·͏ • ͦͷࡍep͔Βͷspͷܭࢉ͕େมʹͳΔͷͰɺepͷॳظΛอଘ͓ͯ͘͠ͱ͍ • Railsʹޮ͔͘: ˕ • Railsͩͱdeoptimizationͷػձଟͦ͏ͩ͠ɺޮ͖ͦ͏
ઓུ6: VMʹؚ·Εͳ͍ϝιουͷΠϯϥΠϯԽ • ର: ؔͷΠϯϥΠϯԽ (MJIT͔ΒͷҠ২) • ϕʔεͷϔομ vm.c ͔ΒͷΈ࡞͍ͬͯΔ͕ɺવଞͷఆٛ͋ͬͨํ͕ྑ͍
• optcarrotʹޮ͘ͷͰͱΓ͋͑ͣ Array#[] ͱ͔͚͖ͩ࣋ͬͯͯΈͨΒޮ͍ͨ • Railsʹޮ͔͘: ˕ • ͪΌΜͱ࣮ͷΈ͕൚༻ԽͰ͖Εޮ͖ͦ͏
ઓུ7: ϝιουͷछྨ͝ͱʹҟͳΔϝιουݺͼग़͠ॲཧͷΠϯϥΠϯԽ • ର: ؔͷΠϯϥΠϯԽ (MJIT͔ΒͷҠ২) • CͰ࣮͞ΕͨϝιουͱRubyͰ࣮͞Εͨϝιουͷݺͼग़͠ॲཧવҧ͏ • ͳͷͰVM໋ྩ͔ΒݟΔͱநԽ͞Ε͍ͯΔ
• YARVόΠτίʔυʹΠϯϥΠϯΩϟογϡΛ͏Ί͜ΈɺͦΕ͕ϝιουͷλΠϓΛ ͍࣋ͬͯΔͷͰɺͦΕʹԠͯ͡ΠϯϥΠϯԽ͢Δ • Railsʹޮ͔͘: ˕ • ϝιουݺͼग़͕͠ଟ͍΄ͲޮՌ͕͋Δ
RailsͰͷYARV-MJITͷ͍ํ
RailsͰͷYARV-MJITͷ͍ํ • ී௨ʹϏϧυ: autoconf && ./configure && make && make
install • rubyόΠφϦʹ͏·͍͜ͱ "-j" ϑϥάΛ͢
RailsͰͷrubyͷΦϓγϣϯͷ͠ํ • RUBYOPT="-j" rails s • ruby -j bin/rails s
·ͱΊ • YARV-MJITΛಋೖͯ͠JITΛͬͨঢ়ଶͳΒ࣮֬ʹRails͕ಈ࡞͢Δ • JITΛ༗ޮʹͨ͠߹·ͩյΕΔϝιου͕͋ΔͷͰɺ͠த • YARV-MJIT/gcc ͕ੜ͢Δίʔυͷ͔ͳΓ MJIT/gcc ʹۙ͘ͳͬͨ
• ·ͩࢼͤͳ͍͕Railsʹޮ͖ͦ͏ɺޤ͏͝ظ