$30 off During Our Annual Pro Sale. View Details »
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.9k
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
6k
Real World Migration from HTTP to gRPC in Ruby #grpcconf
south37
2
4.6k
Getting Things Done をベースにした仕事の進め方 / How to Work with Getting Things Done
south37
8
8.2k
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
1
4.1k
理想的なマイクロサービスアーキテクチャを目指す継続的改善 / Re-architecturing of Microservices #CNDT2019
south37
10
15k
gcpc: Google Cloud Pub/Sub Client for Ruby #tqrk13
south37
1
850
実行計画から学ぶ PostgreSQL の内部動作とクエリ最適化 / Learn PostgreSQL from Explain
south37
8
41k
学びを得るための新卒 ISUCON / New Grad ISUCON for Learning
south37
4
44k
Other Decks in Programming
See All in Programming
Agentに至る道 〜なぜLLMは自動でコードを書けるようになったのか〜
mackee
5
2.5k
JJUG CCC 2025 Fall: Virtual Thread Deep Dive
ternbusty
3
500
20251127_ぼっちのための懇親会対策会議
kokamoto01_metaps
2
220
分散DBって何者なんだ... Spannerから学ぶRDBとの違い
iwashi623
0
140
大体よく分かるscala.collection.immutable.HashMap ~ Compressed Hash-Array Mapped Prefix-tree (CHAMP) ~
matsu_chara
1
180
GeistFabrik and AI-augmented software development
adewale
PRO
0
210
CSC305 Lecture 17
javiergs
PRO
0
200
乱雑なコードの整理から学ぶ設計の初歩
masuda220
PRO
32
15k
Promise.tryで実現する新しいエラーハンドリング New error handling with Promise try
bicstone
3
1.7k
Building AI with AI
inesmontani
PRO
1
380
Stay Hacker 〜九州で生まれ、Perlに出会い、コミュニティで育つ〜
pyama86
2
2.9k
AI時代もSEOを頑張っている話
shirahama_x
0
190
Featured
See All Featured
Scaling GitHub
holman
464
140k
Automating Front-end Workflow
addyosmani
1371
200k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
Producing Creativity
orderedlist
PRO
348
40k
Context Engineering - Making Every Token Count
addyosmani
9
440
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.6k
Navigating Team Friction
lara
190
16k
Become a Pro
speakerdeck
PRO
30
5.6k
How to Ace a Technical Interview
jacobian
280
24k
Documentation Writing (for coders)
carmenintech
76
5.1k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.3k
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