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
cpm at okinawa
Search
Shoichi Kaji
August 27, 2016
Programming
0
130
cpm at okinawa
2016.08.27 okinawa.pm
Shoichi Kaji
August 27, 2016
Tweet
Share
More Decks by Shoichi Kaji
See All by Shoichi Kaji
宿泊予約サイトにおける検索と料金計算の両立
skaji
2
2.5k
昔のGo, 今のGo ~比較, ソート編~
skaji
0
170
Perl Quiz
skaji
0
130
cpm at PerlCon 2019
skaji
0
110
Perl5 Package Manager
skaji
0
660
Internal of cpm
skaji
0
570
How to execute external programs in Perl
skaji
3
570
Writing Perl with w0rp/ale
skaji
0
2.2k
nginx unit
skaji
0
44
Other Decks in Programming
See All in Programming
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
340
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
役立つログに取り組もう
irof
28
9.6k
Jakarta EE meets AI
ivargrimstad
0
600
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
610
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
130
Arm移行タイムアタック
qnighy
0
330
Jakarta EE meets AI
ivargrimstad
0
670
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
10
1.3k
Featured
See All Featured
KATA
mclloyd
29
14k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Making Projects Easy
brettharned
115
5.9k
The Cult of Friendly URLs
andyhume
78
6k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
900
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
A Philosophy of Restraint
colly
203
16k
How STYLIGHT went responsive
nonsquared
95
5.2k
How GitHub (no longer) Works
holman
310
140k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
100
Transcript
cpm Shoichi Kaji
About me • Shoichi Kaji • Born in 1984 •
Born in Kanagawa, live in Tokyo • Work for Yahoo JAPAN • pause/github: skaji • perl5: cpm, Mojo::SlackRTM • perl6: mi6, frinfon
cpm fast CPAN module installer
None
None
cpm is 3x faster than cpanm
ࠓ͍ͨ͜͠ͱ • ͳͥcpmΛͭ͘Ζ͏ͱࢥ͔ͬͨ • ͞Λ࣮ݱ͢ΔͨΊͷ࣮Ҋ • CPAN moduleΠϯετʔϧฒྻԽԿ͕໘͔ • ͦͷ໘͞Λ͍͔ʹγϯϓϧʹଊ͔͑ͨ
• ࣮ͷΩʔϙΠϯτ • ݱঢ়ͷ࣮ • ࠓޙ
ͳͥcpmΛͭ͘Ζ͏ͱࢥ͔ͬͨ • CPAN moduleΛ͍͍ͭͬͯͨ (ͪΖΜࠓ) • ͬͱ͘ΠϯετʔϧͰ͖Εͳɺͱ͍ͭࢥͬ ͍ͯͨ • CPAN
moduleΠϯετʔϧ͋ΔछϒϥοΫϘο Ϋεͱͳ͍ͬͯͯखΛग़͢ਓඇৗʹݶΒΕ͍ͯͨ • ͷࢼ͠ɺͬͯΈΑ͏
ͳͥcpmΛͭ͘Ζ͏ͱࢥ͔ͬͨ • ͍ͨ͘͠ͱ͍͏ࢥ͍͕CPAN clientʹ࣮ࡍʹखΛग़ ͖͔͚ͬ͢Ͱ͋Δ͜ͱؒҧ͍ͳ͍͕ɺͦΕҎ֎ʹ • CPANʹ·ͭΘΔऔΓܾΊΛͬͱγϯϓϧʹͰ͖ ͳ͍͔ɻͦ͏ͳΕɺࣗΛؚΊͯΈΜͳͬͱ؆ ୯ʹCPANΛhackͰ͖ΔΑ͏ʹͳΓָͦ͠͏ •
ͱ͍͏ࢥ͍͕͋ͬͨɻͦͷ࣮ྫͱͳΔΛ͔ͨͬ͠ ͨɻ
͞Λ࣮ݱ͢ΔͨΊͷ࣮Ҋ • cpanm"ྻ"ʹCPAN moduleΛΠϯετʔϧ͍ͯͨ͘͠Ί ͋·Γ͘ͳ͍ɻͲ͏͢Δ͔ɻ(perl5Ͱ"͞"ΛٻΊΔͱ͢Ε event driven or fork(2)ͱ͍͏͜ͱʹͳΔɻ) •
(Ҋ1) event driven Ͱ͖ΔݶΓcpanmͷίʔυΛ࠶ར༻͔ͨͬͨ͠ɻevent drivenͷίʔυͷதͰcpanmΛ͏ͷͪΐͬͱແཧɻ • (Ҋ2) forkΛ͏ ·͋ͪ͜ΒͰɻ
CPAN moduleฒྻԽ Կ͕໘͔ • ࣄલʹͯ͢ͷtask͕ܾ·͍ͬͯͳ͍ɻ ྫ͑ PlackΛΠϯετʔϧ͠Α͏ͱ͢Δͱ͖ • ࠷ॳ"PlackΠϯετʔϧ"ͱ͍͏task͚͕ͩͩ •
ͦΕͷmetadataΛfetchͨ͠ஈ֊ͰॳΊͯ File::ShareDir::InstallͷΠϯετʔϧඞཁͩͱൃ֮͢Δɻ • ͞ΒʹFSDIͷmetadataΛfetch͢ΔͱModule::Build::Tiny ඞཁͩͱൃ֮͢Δɻblah blah blah…
ͦͷ໘͞Λ͍͔ʹ γϯϓϧʹଊ͔͑ͨ • (1) "CPAN moduleΠϯετʔϧ"Λɺ ಠཱͰ࣮ߦՄೳͳࡉ͔͍taskʹ͚Δɻ(ࠓճ ͜ͷઆ໌লུ) • (2)
ͦͷtaskΛworkerʹৼΓɺ݁ՌΛऩूͯ͠ɺ ͞Βʹ৽ͨͳtask͕ੜ·ΕΕɺ࠶ͼworkerʹ ৼΔɻ͜ΕΛtask͕ͳ͘ͳΔ·Ͱ܁Γฦ͢ɻ
(2)ͷ࣮ΩʔϙΠϯτ • (point1) workerʹtaskΛৼΔɺͦͯͦ͠ͷ݁Ռ Λऩू͢ΔͨΊʹɺԿ͔͠ΒͷIPC͕ඞཁ • (point2) ৽ͨͳtask͕ੜ·Εͨͱ͖ɺfinished/ readyͳworkerΛૉૣ͘ݕͦ͠ͷworkerʹ taskΛৼΔΈ͕ඞཁ
ૉૣ͘ͱ͍͏ͱ͜Ζ͕ॏཁͰɺ͜Ε͕͍ͱ༡Μ Ͱ͍Δ͕࣌ؒ૿͑ͯશ͘͞ʹͭͳ͕Βͳ͍
• ͡ΊIPCͱͯ͠ϑΝΠϧΛ͍ɺwoker͔Βͷ ݁Ռͷฦ٫ϑΝΠϧʹͦΕΛॻ͘͜ͱͰ࣮ݱ ͠Α͏ͱͨ͠ɻ(ۮવkarupa͞Μͱ͔Ϳͬͨw) • ͦͯ͠filesystemͷchange notifyʹΑͬͯ workerͷfinishedΛݕ͠Α͏ͱͨ͠ɻ • …
͗ͯ͢ෆ࠾༻ɻ
ݱঢ়ͷ࣮ • ݁ہɺIPCͱͯ͠pipe(2)Λ͏͜ͱʹͨ͠ɻworkerͱ ͷؒʹ2ຊͷpipeΛ௨ͯ͠ํͰ௨৴Ͱ͖ΔΑ͏ʹɻ • finishedͳworkerݕselect(2)Λ͏ɻ • ظ௨Γͷ͞ͰfinishedΛݕͰ͖ͨ • ݁Ռɺcpanm
3xͷ͞ͰCPAN moduleΛΠϯετʔ ϧͰ͖ΔΑ͏ʹͳͬͨ
worker worker worker worker main process Parallel::Pipes pipes pipes pipes
pipes ݱঢ়ͷ࣮ (Πϝʔδ)
ࠓޙ • cpm is a fast CPAN module installer •
cpmΛsandboxͱͯ͠CPANͷ͋Δ͖࢟Λࡧͨ͠ ͍ • Ͱɺcpanmʹ͍͍ͱ͜ΖΛؐݩ͢Δʂ • cpmͷparallelͷ෦Parallel::Pipesͱͯ͠Ϟδϡʔ ϧʹͤͨ͞ɻଞʹԠ༻Մೳͩͱࢥ͍ͬͯΔͷͰɺ ୭͔ʹͬͯΒ͍͍ͨ :-)