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
13k
Ruby JIT Hacking Guide / RubyKaigi 2023
k0kubun
2
9.5k
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
420
Why Ruby's JIT was slow / RubyKaigi Takeout 2021
k0kubun
3
1.9k
数時間かかる週一リリースを毎日何度も爆速でできるようにするまで / CI/CD Conference 2021
k0kubun
21
14k
Ruby 3 JIT's roadmap / RubyConf China 2020
k0kubun
0
770
Ruby 3.0 JIT on Rails
k0kubun
9
9.1k
Other Decks in Programming
See All in Programming
週次リリースを実現するための グローバルアプリ開発
tera_ny
1
110
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
300
Jakarta EE meets AI
ivargrimstad
0
290
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
180
CloudflareStack でRAGに入門
asahiiwm
0
130
これでLambdaが不要に?!Step FunctionsのJSONata対応について
iwatatomoya
2
3.8k
暇に任せてProxmoxコンソール 作ってみました
karugamo
2
740
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
9
2k
nekko cloudにおけるProxmox VE利用事例
irumaru
3
470
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
360
Kaigi on Railsに初参加したら、その日にLT登壇が決定した件について
tama50505
0
110
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
290
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
180
GitHub's CSS Performance
jonrohan
1031
460k
Speed Design
sergeychernyshev
25
680
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Documentation Writing (for coders)
carmenintech
67
4.5k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
GraphQLとの向き合い方2022年版
quramy
44
13k
Visualization
eitanlees
146
15k
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ʹޮ͖ͦ͏ɺޤ͏͝ظ