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
MCP with Cloudflare Workers
yusukebe
2
220
Recoilを剥がしている話
kirik
5
6.7k
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
750
testcontainers のススメ
sgash708
1
120
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
170
暇に任せてProxmoxコンソール 作ってみました
karugamo
2
720
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
130
バグを見つけた?それAppleに直してもらおう!
uetyo
0
180
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
210
return文におけるstd::moveについて
onihusube
1
1.1k
命名をリントする
chiroruxx
1
400
Haze - Real time background blurring
chrisbanes
1
510
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Designing for humans not robots
tammielis
250
25k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.3k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Thoughts on Productivity
jonyablonski
67
4.4k
It's Worth the Effort
3n
183
28k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Adopting Sorbet at Scale
ufuk
73
9.1k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Designing Experiences People Love
moore
138
23k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
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ͱͯ͠Ϟδϡʔ ϧʹͤͨ͞ɻଞʹԠ༻Մೳͩͱࢥ͍ͬͯΔͷͰɺ ୭͔ʹͬͯΒ͍͍ͨ :-)