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
3.6k
昔のGo, 今のGo ~比較, ソート編~
skaji
0
180
Perl Quiz
skaji
0
130
cpm at PerlCon 2019
skaji
0
110
Perl5 Package Manager
skaji
0
660
Internal of cpm
skaji
0
580
How to execute external programs in Perl
skaji
3
580
Writing Perl with w0rp/ale
skaji
0
2.2k
nginx unit
skaji
0
44
Other Decks in Programming
See All in Programming
DevFest Tokyo 2025 - Flutter のアプリアーキテクチャ現在地点
wasabeef
5
910
創造的活動から切り拓く新たなキャリア 好きから始めてみる夜勤オペレーターからSREへの転身
yjszk
1
130
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
940
Go の GC の不得意な部分を克服したい
taiyow
3
790
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
490
暇に任せてProxmoxコンソール 作ってみました
karugamo
2
720
テストコードのガイドライン 〜作成から運用まで〜
riku929hr
4
590
Haze - Real time background blurring
chrisbanes
1
510
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
770
これでLambdaが不要に?!Step FunctionsのJSONata対応について
iwatatomoya
2
3.7k
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
130
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Typedesign – Prime Four
hannesfritz
40
2.4k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Facilitating Awesome Meetings
lara
50
6.1k
Building Adaptive Systems
keathley
38
2.3k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
The Pragmatic Product Professional
lauravandoore
32
6.3k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Why Our Code Smells
bkeepers
PRO
335
57k
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ͱͯ͠Ϟδϡʔ ϧʹͤͨ͞ɻଞʹԠ༻Մೳͩͱࢥ͍ͬͯΔͷͰɺ ୭͔ʹͬͯΒ͍͍ͨ :-)