Skip to content

Instantly share code, notes, and snippets.

@skaji
Last active March 6, 2017 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skaji/24de4a819ca4a84b2018f5ee996ac52a to your computer and use it in GitHub Desktop.
Save skaji/24de4a819ca4a84b2018f5ee996ac52a to your computer and use it in GitHub Desktop.

How fast?

(conti) http://blogs.perl.org/users/shoichi_kaji1/2017/03/make-your-cpan-module-static-installable.html

Let's compare non-static-install with static-install.

Non-static-install

Let's prepare a local cpan-mirror as follows:

> find cpan-mirror | grep tar.gz
cpan-mirror/authors/id/A/AR/ARISTOTLE/Hash-MultiValue-0.16.tar.gz
cpan-mirror/authors/id/C/CH/CHANSEN/HTTP-MultiPartParser-0.01.tar.gz
cpan-mirror/authors/id/C/CJ/CJM/IO-HTML-1.001.tar.gz
cpan-mirror/authors/id/D/DO/DOY/Stream-Buffered-0.03.tar.gz
cpan-mirror/authors/id/D/DR/DROLSKY/Devel-StackTrace-2.02.tar.gz
cpan-mirror/authors/id/E/ET/ETHER/File-ShareDir-Install-0.11.tar.gz
cpan-mirror/authors/id/E/ET/ETHER/HTTP-Message-6.11.tar.gz
cpan-mirror/authors/id/E/ET/ETHER/JSON-MaybeXS-1.003009.tar.gz
cpan-mirror/authors/id/E/ET/ETHER/Try-Tiny-0.28.tar.gz
cpan-mirror/authors/id/E/ET/ETHER/URI-1.71.tar.gz
cpan-mirror/authors/id/E/EX/EXODIST/Test-SharedFork-0.35.tar.gz
cpan-mirror/authors/id/G/GA/GAAS/Encode-Locale-1.05.tar.gz
cpan-mirror/authors/id/G/GA/GAAS/HTTP-Date-6.02.tar.gz
cpan-mirror/authors/id/G/GA/GAAS/LWP-MediaTypes-6.02.tar.gz
cpan-mirror/authors/id/K/KA/KAZEBURO/Apache-LogFormat-Compiler-0.33.tar.gz
cpan-mirror/authors/id/K/KA/KAZEBURO/Cookie-Baker-0.07.tar.gz
cpan-mirror/authors/id/K/KA/KAZEBURO/HTTP-Entity-Parser-0.19.tar.gz
cpan-mirror/authors/id/K/KA/KAZEBURO/POSIX-strftime-Compiler-0.42.tar.gz
cpan-mirror/authors/id/K/KA/KAZEBURO/WWW-Form-UrlEncoded-0.24.tar.gz
cpan-mirror/authors/id/L/LE/LEONT/ExtUtils-Config-0.008.tar.gz
cpan-mirror/authors/id/L/LE/LEONT/ExtUtils-Helpers-0.026.tar.gz
cpan-mirror/authors/id/L/LE/LEONT/ExtUtils-InstallPaths-0.011.tar.gz
cpan-mirror/authors/id/L/LE/LEONT/Module-Build-0.4220.tar.gz
cpan-mirror/authors/id/L/LE/LEONT/Module-Build-Tiny-0.039.tar.gz
cpan-mirror/authors/id/M/MI/MIYAGAWA/Devel-StackTrace-AsHTML-0.15.tar.gz
cpan-mirror/authors/id/M/MI/MIYAGAWA/Filesys-Notify-Simple-0.12.tar.gz
cpan-mirror/authors/id/M/MI/MIYAGAWA/Plack-1.0043.tar.gz
cpan-mirror/authors/id/P/PL/PLICEASE/Class-Inspector-1.31.tar.gz
cpan-mirror/authors/id/R/RE/REHSACK/File-ShareDir-1.102.tar.gz
cpan-mirror/authors/id/R/RJ/RJBS/Test-Deep-1.126.tar.gz
cpan-mirror/authors/id/R/RU/RURBAN/Cpanel-JSON-XS-3.0227.tar.gz
cpan-mirror/authors/id/S/SY/SYOHEX/Test-TCP-2.17.tar.gz
cpan-mirror/authors/id/T/TO/TOKUHIROM/HTTP-Headers-Fast-0.21.tar.gz

Then it took 28sec to install Plack.

$ time cpanm-menlo -M $PWD/cpan-mirror -Llocal -nq Plack
Successfully installed ExtUtils-Config-0.008
...
Successfully installed Plack-1.0043
33 distributions installed

real	0m28.831s
user	0m18.853s
sys	0m6.157s

Static-install

It seems that the distributions checked by "YES" can be static installable:

YES cpan-mirror/authors/id/A/AR/ARISTOTLE/Hash-MultiValue-0.16.tar.gz
YES cpan-mirror/authors/id/C/CH/CHANSEN/HTTP-MultiPartParser-0.01.tar.gz
YES cpan-mirror/authors/id/C/CJ/CJM/IO-HTML-1.001.tar.gz
YES cpan-mirror/authors/id/D/DO/DOY/Stream-Buffered-0.03.tar.gz
YES cpan-mirror/authors/id/D/DR/DROLSKY/Devel-StackTrace-2.02.tar.gz
YES cpan-mirror/authors/id/E/ET/ETHER/File-ShareDir-Install-0.11.tar.gz
YES cpan-mirror/authors/id/E/ET/ETHER/HTTP-Message-6.11.tar.gz
NO  cpan-mirror/authors/id/E/ET/ETHER/JSON-MaybeXS-1.003009.tar.gz
YES cpan-mirror/authors/id/E/ET/ETHER/Try-Tiny-0.28.tar.gz
YES cpan-mirror/authors/id/E/ET/ETHER/URI-1.71.tar.gz
YES cpan-mirror/authors/id/E/EX/EXODIST/Test-SharedFork-0.35.tar.gz
YES cpan-mirror/authors/id/G/GA/GAAS/Encode-Locale-1.05.tar.gz
YES cpan-mirror/authors/id/G/GA/GAAS/HTTP-Date-6.02.tar.gz
YES cpan-mirror/authors/id/G/GA/GAAS/LWP-MediaTypes-6.02.tar.gz
YES cpan-mirror/authors/id/K/KA/KAZEBURO/Apache-LogFormat-Compiler-0.33.tar.gz
YES cpan-mirror/authors/id/K/KA/KAZEBURO/Cookie-Baker-0.07.tar.gz
YES cpan-mirror/authors/id/K/KA/KAZEBURO/HTTP-Entity-Parser-0.19.tar.gz
YES cpan-mirror/authors/id/K/KA/KAZEBURO/POSIX-strftime-Compiler-0.42.tar.gz
NO  cpan-mirror/authors/id/K/KA/KAZEBURO/WWW-Form-UrlEncoded-0.24.tar.gz
YES cpan-mirror/authors/id/L/LE/LEONT/ExtUtils-Config-0.008.tar.gz
YES cpan-mirror/authors/id/L/LE/LEONT/ExtUtils-Helpers-0.026.tar.gz
YES cpan-mirror/authors/id/L/LE/LEONT/ExtUtils-InstallPaths-0.011.tar.gz
NO  cpan-mirror/authors/id/L/LE/LEONT/Module-Build-0.4220.tar.gz
YES cpan-mirror/authors/id/L/LE/LEONT/Module-Build-Tiny-0.039.tar.gz
YES cpan-mirror/authors/id/M/MI/MIYAGAWA/Devel-StackTrace-AsHTML-0.15.tar.gz
YES cpan-mirror/authors/id/M/MI/MIYAGAWA/Filesys-Notify-Simple-0.12.tar.gz
YES cpan-mirror/authors/id/M/MI/MIYAGAWA/Plack-1.0043.tar.gz
YES cpan-mirror/authors/id/P/PL/PLICEASE/Class-Inspector-1.31.tar.gz
YES cpan-mirror/authors/id/R/RE/REHSACK/File-ShareDir-1.102.tar.gz
YES cpan-mirror/authors/id/R/RJ/RJBS/Test-Deep-1.126.tar.gz
NO  cpan-mirror/authors/id/R/RU/RURBAN/Cpanel-JSON-XS-3.0227.tar.gz
YES cpan-mirror/authors/id/S/SY/SYOHEX/Test-TCP-2.17.tar.gz
YES cpan-mirror/authors/id/T/TO/TOKUHIROM/HTTP-Headers-Fast-0.21.tar.gz

If I tweaked the distributions checked by "YES" so that their META.json/yml have x_static_install 1, then it took only 9sec to install Plack!

$ time cpanm-menlo -M $PWD/cpan-mirror -Llocal -nq Plack
Successfully installed Hash-MultiValue-0.16
...
Successfully installed Plack-1.0043
29 distributions installed

real	0m9.170s
user	0m6.346s
sys	0m2.056s

Conclusion

If we just make CPAN distribuions static installable, then the installation of CPAN distribuions become 3x faster. 😄 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment