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
8
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
780
実行計画から学ぶ PostgreSQL の内部動作とクエリ最適化 / Learn PostgreSQL from Explain
south37
8
39k
学びを得るための新卒 ISUCON / New Grad ISUCON for Learning
south37
4
42k
Other Decks in Programming
See All in Programming
採用事例の少ないSvelteを選んだ理由と それを正解にするためにやっていること
oekazuma
2
1.1k
useSyncExternalStoreを使いまくる
ssssota
6
1.4k
歴史と現在から考えるスケーラブルなソフトウェア開発のプラクティス
i10416
0
140
各クラウドサービスにおける.NETの対応と見解
ymd65536
0
190
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
MCP with Cloudflare Workers
yusukebe
2
230
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
540
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
290
Jakarta EE meets AI
ivargrimstad
0
290
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
4
790
Beyond ORM
77web
9
1.2k
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
660
Featured
See All Featured
Visualization
eitanlees
146
15k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.6k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Making Projects Easy
brettharned
116
6k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.4k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Become a Pro
speakerdeck
PRO
26
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