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
1.6k
昔のGo, 今のGo ~比較, ソート編~
skaji
0
150
Perl Quiz
skaji
0
130
cpm at PerlCon 2019
skaji
0
110
Perl5 Package Manager
skaji
0
650
Internal of cpm
skaji
0
570
How to execute external programs in Perl
skaji
3
560
Writing Perl with w0rp/ale
skaji
0
2.2k
nginx unit
skaji
0
44
Other Decks in Programming
See All in Programming
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
180
Tuning GraphQL on Rails
pyama86
2
900
Nuxt UI Pro、NuxtHub、Nuxt Scripts、Nuxtエコシステムをふんだんに利用して開発するコーポレートサイト@Vue Fes Japan 2024
shingangan
3
860
offers_20241022_imakiire.pdf
imakurusu
2
330
Re:proS_案内資料
rect
0
270
Kaigi on Rails 2024 - Rails APIモードのためのシンプルで効果的なCSRF対策 / kaigionrails-2024-csrf
corocn
4
3.1k
PLoP 2024: The evolution of the microservice architecture pattern language
cer
PRO
0
1.2k
Vue SFCのtemplateでTypeScriptの型を活用しよう
tsukkee
3
1.4k
Why Spring Matters to Jakarta EE - and Vice Versa
ivargrimstad
0
670
飲食業界向けマルチプロダクトを実現させる開発体制とリアルな現状
hiroya0601
1
380
生成 AI を活用した toitta 切片分類機能の裏側 / Inside toitta's AI-Based Factoid Clustering
pokutuna
0
540
/←このスケジュール表に立ち向かう フロントエンド開発戦略 / A front-end development strategy to tackle a single-slash schedule.
nrslib
1
590
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
0
34
Build The Right Thing And Hit Your Dates
maggiecrowley
32
2.4k
The Cost Of JavaScript in 2023
addyosmani
45
6.5k
Gamification - CAS2011
davidbonilla
80
5k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
167
49k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Navigating Team Friction
lara
183
14k
GitHub's CSS Performance
jonrohan
1030
460k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
92
16k
Code Reviewing Like a Champion
maltzj
519
39k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
228
52k
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ͱͯ͠Ϟδϡʔ ϧʹͤͨ͞ɻଞʹԠ༻Մೳͩͱࢥ͍ͬͯΔͷͰɺ ୭͔ʹͬͯΒ͍͍ͨ :-)