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
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
OSSで起業してもうすぐ10年 / Open Source Conference 2024 Shimane
furukawayasuto
0
110
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
130
Remix on Hono on Cloudflare Workers
yusukebe
1
290
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
300
Macとオーディオ再生 2024/11/02
yusukeito
0
370
Jakarta EE meets AI
ivargrimstad
0
650
C++でシェーダを書く
fadis
6
4.1k
CSC509 Lecture 12
javiergs
PRO
0
160
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
距離関数を極める! / SESSIONS 2024
gam0022
0
280
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
Featured
See All Featured
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
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ͱͯ͠Ϟδϡʔ ϧʹͤͨ͞ɻଞʹԠ༻Մೳͩͱࢥ͍ͬͯΔͷͰɺ ୭͔ʹͬͯΒ͍͍ͨ :-)