frangio / netlify-latex

🗞️ A Netlify template for LaTeX projects.
https://latex.netlify.app
MIT License
21 stars 6 forks source link

Install individual packages instead of collections #7

Closed edemaine closed 3 years ago

edemaine commented 4 years ago

(Item 1 from https://github.com/frangio/netlify-latex/issues/6#issuecomment-707937166)

To speed up the initial build, I tried to replace big collections with a minimal set of specific packages, leaving texliveonfly to do the hard work of installing more.

Performance

I just did a fresh deploy before and after this PR on Netlify (with cache cleared), and got a 1m 58s = 58% reduction. The improvement is more impressive if you just measure the texlive installation time (time between [build.sh] Installing TeX Live... and [build.sh] Installed TeX Live. messages): almost 3x faster!

Version TeX Live install texliveonfly run Total build (as billed by Netlify)
Before PR 2m 22s 0m 49s 3m 23s
Alternative 0m 48s 1m 24s 2m 25s
After PR 0m 43s 0m 32s 1m 25s

Of course, there is probably some measurement error here, and the improvement might get better or worse for different examples. But this PR seems in the spirit of this build script of "install just enough and let texliveonfly deal with the rest". And given that it improves both the TeX Live install time and the texliveonfly run, it seems like a pretty sure win. (See below for description of the "Alternative" row in the middle, which was a first version of this PR, where the winning was less clear, where texliveonfly had to do a lot more work.)

Which collections to include?

http://mirror.ctan.org/systems/texlive/tlnet/tlpkg/texlive.tlpdb lists the contents of the various texlive collections. Here are the details for the three that were installed: