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.6k
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
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
200
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
ヤプリ新卒SREの オンボーディング
masaki12
0
130
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
610
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.1k
初めてDefinitelyTypedにPRを出した話
syumai
0
400
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
受け取る人から提供する人になるということ
little_rubyist
0
230
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
427
64k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Docker and Python
trallard
40
3.1k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Gamification - CAS2011
davidbonilla
80
5k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
89
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