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
Ruby 2.4 のハッシュテーブル高速化を理解する
Search
Nao Minami
April 20, 2017
Programming
3
6.7k
Ruby 2.4 のハッシュテーブル高速化を理解する
第2回 meguro.rb LT で Ruby 2.4 のハッシュテーブル実装について話しました
https://megurorb.connpass.com/event/55107/
Nao Minami
April 20, 2017
Tweet
Share
More Decks by Nao Minami
See All by Nao Minami
Real World Migration from HTTP to gRPC #CNDT2020
south37
3
5.7k
Real World Migration from HTTP to gRPC in Ruby #grpcconf
south37
2
4.3k
Getting Things Done をベースにした仕事の進め方 / How to Work with Getting Things Done
south37
7
7.7k
Web API に秩序を与える Protocol Buffers / Protocol Buffers for Web API #builderscon
south37
18
16k
puma v4 では SIGTERM での worker process ゾンビ化に気をつけよう / Be aware of zombie processes in puma v4
south37
0
3.7k
理想的なマイクロサービスアーキテクチャを目指す継続的改善 / Re-architecturing of Microservices #CNDT2019
south37
10
14k
gcpc: Google Cloud Pub/Sub Client for Ruby #tqrk13
south37
1
760
実行計画から学ぶ PostgreSQL の内部動作とクエリ最適化 / Learn PostgreSQL from Explain
south37
8
39k
学びを得るための新卒 ISUCON / New Grad ISUCON for Learning
south37
4
41k
Other Decks in Programming
See All in Programming
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
110
イベント駆動で成長して委員会
happymana
1
340
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
15
2.3k
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
130
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
970
Ethereum_.pdf
nekomatu
0
470
DevTools extensions で 独自の DevTool を開発する | FlutterKaigi 2024
kokiyoshida
0
140
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
170
C++でシェーダを書く
fadis
6
4.2k
Jakarta EE meets AI
ivargrimstad
0
370
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
CSC509 Lecture 11
javiergs
PRO
0
180
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Bash Introduction
62gerente
608
210k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Code Reviewing Like a Champion
maltzj
520
39k
Faster Mobile Websites
deanohume
305
30k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Embracing the Ebb and Flow
colly
84
4.5k
Transcript
3VCZͷϋογϡςʔϒϧ ߴԽΛཧղ͢Δ /BP.JOBNJ !TPVUI
ࣗݾհ
/BP.JOBNJ!TPVUI !NJOBNJP 4PGUXBSFFOHJOFFS !8BOUFEMZ *OD
w 3VCZͱύϑΥʔϚϯε w 3VCZͰͷϋογϡςʔϒϧߴԽͱͦͷԸܙ w ߴԽͲ͏࣮ݱ͞Εͨͷ͔ʁ w ·ͱΊ ࠓ͢༰
w 3VCZͱύϑΥʔϚϯε w 3VCZͰͷϋογϡςʔϒϧߴԽͱͦͷԸܙ w ߴԽͲ͏࣮ݱ͞Εͨͷ͔ʁ w ·ͱΊ ࠓ͢༰
3VCZY
w ·Ͱʹ3VCZഒ͘ͳΔCZ!NBU[ 3VCZͱύϑΥʔϚϯε w .VMUJ5ISFBE +*5 FUD w 3VCZY w
3VCZͰͷϋογϡςʔϒϧߴԽ /&8
w 3VCZͱύϑΥʔϚϯε w 3VCZͰͷϋογϡςʔϒϧߴԽͱͦͷԸܙ w ߴԽͲ͏࣮ݱ͞Εͨͷ͔ʁ w ·ͱΊ ࠓ͢༰
ϋογϡςʔϒϧߴԽͱͦͷԸܙ
ϋογϡςʔϒϧߴԽͱͦͷԸܙ
ϋογϡςʔϒϧߴԽͱͦͷԸܙ w 36#:#&/$) w ߴԽ w ϝϞϦ༻ྔݮ 1000000.times.map{|i| a={}; 8.times{|j|
a[j]=j}; a} IUUQTSVCZCFODIPSHSVCZSVCZSFMFBTFT SFTVMU@UZQFIBTI@TNBMM
ϋογϡςʔϒϧߴԽͱͦͷԸܙ w QJDP@IUUQ@QBSTFS w ߴԽ IUUQLB[FCVSPIBUFOBCMPHDPNFOUSZ ʜ3VCZ ੨ʜ3VCZQSF
ܶతʹ͘ͳͬͯΔ
w 3VCZͱύϑΥʔϚϯε w 3VCZͰͷϋογϡςʔϒϧߴԽͱͦͷԸܙ w ߴԽͲ͏࣮ݱ͞Εͨͷ͔ʁ w ·ͱΊ ࠓ͢༰
ߴԽͲ͏࣮ݱ͞Εͨͷ͔ʁ w ϋογϡςʔϒϧͷিಥ࣌ͷڍಈΛมߋ $IBJOJOH 0QFO"ESFTTJOH w ϙΠϯτʮσʔλͷہॴੑͷ্ʯ
σʔλͷہॴੑͳͥॏཁ͔ w 1SPDFTTPSʹଟஈΩϟογϡ͕ଘࡏ w ΩϟογϡʹIJU͢ΔͱύϑΥʔϚϯε্ $16 L# .BJO.FNPSZ -$BDIF -$BDIF
-$BDIF .# (# L# # dOT IUUQTUBDLPWFSqPXDPNRVFTUJPOTBQQSPYJNBUFDPTUUPBDDFTTWBSJPVTDBDIFTBOENBJONFNPSZ dOT
σʔλͷہॴੑͳͥॏཁ͔ w 1SPDFTTPSʹଟஈΩϟογϡ͕ଘࡏ w σʔλͷہॴੑ͕ॏཁ $16 L# .BJO.FNPSZ -$BDIF -$BDIF
-$BDIF .# (# L# # dOT IUUQTUBDLPWFSqPXDPNRVFTUJPOTBQQSPYJNBUFDPTUUPBDDFTTWBSJPVTDBDIFTBOENBJONFNPSZ dOT
0QFO"ESFTTJOHͰσʔλͷہॴੑ্͕͕Δͷͳͥʁ w $IBJOJOH 0QFO"ESFTTJOHͭͷΞϧΰϦζϜΛൺֱ w ૬ҧϋογϡςʔϒϧͷিಥ࣌ͷڍಈ w $IBJOJOH࿈݁ϦετΛḷͬͯ୳ࡧ w 0QFO"ESFTTJOH"SSBZ্ͰJOEFYΛม͑ͯ୳ࡧ
w ڞ௨ w ϋογϡςʔϒϧLFZͷIBTIΛJOEFYʹར༻
$IBJOJOHͷΈ w UBCMF࿈݁ϦετͷϙΠϯλΛอ࣋ w ಉ͡IBTIΛ࣋ͭ߹ɺ࿈݁ϦετΛḷΔ IUUQXXXBMHPMJTUOFU%BUB@TUSVDUVSFT)BTI@UBCMF$IBJOJOH FOUSZ UBCMF LFZ
$IBJOJOHͷ w ࿈݁ϦετͷFOUSZɺNFNPSZ্ͰΕͯஔ w σʔλͷہॴੑ͕͍ FOUSZ UBCMF LFZ
3VCZҎલͷ$IBJOJOH w ํϦετʹͳ͓ͬͯΓɺσʔλͷہॴੑ͕͍ ͚ͩͰͳ͘QSFWϙΠϯλͳͲͷ͚ͩFOUSZͷσʔ λ͕Ͱ͔͍ͷ IUUQTEFWFMPQFSTSFEIBUDPNCMPHUPXBSETGBTUFSSVCZIBTIUBCMFT UBCMF FOUSZ FOUSZ FOUSZ
3VCZҎલͷ$IBJOJOH w ํϦετʹͳ͓ͬͯΓɺσʔλͷہॴੑ͕͍ ͚ͩͰͳ͘QSFWϙΠϯλͳͲͷ͚ͩFOUSZͷσʔ λ͕Ͱ͔͍ͷ IUUQTEFWFMPQFSTSFEIBUDPNCMPHUPXBSETGBTUFSSVCZIBTIUBCMFT UBCMF FOUSZ FOUSZ FOUSZ
͍
0QFO"ESFTTJOHͷΈ w UBCMFFOUSZͷQPJOUFSΛอ࣋ w ಉ͡IBTIΛ࣋ͭ߹ɺJOEFYΛͣΒ͢ FOUSZ UBCMF LFZ IUUQXXXBMHPMJTUOFU%BUB@TUSVDUVSFT)BTI@UBCMF0QFO@BEESFTTJOH
3VCZͷ0QFO"ESFTTJOH UBCMF FOUSJFT TUBSU CPVOE w UBCMF FOUSJFT͕྆ํ"SSBZʹͳ͓ͬͯΓσʔλͷہॴ ੑ͕ߴ͘ɺͭͭͷFOUSZͷσʔλαΠζখ͍͞ IUUQTEFWFMPQFSTSFEIBUDPNCMPHUPXBSETGBTUFSSVCZIBTIUBCMFT
3VCZͷ0QFO"ESFTTJOH UBCMF FOUSJFT TUBSU CPVOE w UBCMF FOUSJFT͕྆ํ"SSBZʹͳ͓ͬͯΓσʔλͷہॴ ੑ͕ߴ͘ɺͭͭͷFOUSZͷσʔλαΠζখ͍͞ ߴԽ
3VCZͰߋʹࡉ͔͘࠷దԽ w ͕݅গͳ͍࣌ͷ࠷దԽʢলϝϞϦɺߴԽʣ w ͕݅গͳ͍࣌BSSBZͭͰMJOFBSTFBSDI w ͕݅গͳ͍࣌CJU CJUͳͲͰJOEFYΛදݱ w 'VMMDZDMFMJOFBSDPOHSVFOUJBMHFOFSBUPSΛ
TFDPOEBSZIBTIͱͯ͠ར༻ w ߴ͔ͭIBTIͱͯ͠ͷੑೳྑ͍
w 3VCZͱύϑΥʔϚϯε w 3VCZͰͷϋογϡςʔϒϧߴԽͱͦͷԸܙ w ߴԽͲ͏࣮ݱ͞Εͨͷ͔ʁ w ·ͱΊ ࠓ͢༰
·ͱΊ w 3VCZϋογϡςʔϒϧ͕ܶతʹߴԽɻ࣮ࡍ ʹΞϓϦέʔγϣϯߴԽɻ w 3VCZʹͯ͠շదͳ3VCZϥΠϑΛૹΖ͏ʂ
ࢀߟϦϯΫ w 3VCZϦϦʔε w IUUQTXXXSVCZMBOHPSHKBOFXT SVCZSFMFBTFE w 'FBUVSF)BTIUBCMFTXJUIPQFOBESFTTJOH w IUUQTCVHTSVCZMBOHPSHJTTVFT
w 5PXBSET'BTUFS3VCZ)BTI5BCMFT w IUUQTEFWFMPQFSTSFEIBUDPNCMPHUPXBSET GBTUFSSVCZIBTIUBCMFT