-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jekyll/Liquid generation is dead-slow because of tutorial ToC #607
Comments
I am not sure if speed is really something that need to optimized for. It is just an annoyance. What is your motivation for working on it? |
@jarrodwb getting the site build down time from minutes to seconds seems like a pretty sweet improvement to me, if it can be done! |
Okay you convinced me. ;) |
at scala/scala-lang#493 (comment) Simon seemed to be saying this was fixed in his fork, so it might be worth looking there and trying to find what the relevant change was |
Just to respond to @dragos's description; yes I think there's a way to get rid of all of the loops. Back when I built this whole thing, there were no categories or tags built into Jekyll (they were only available as plugins, which were incompatible with GitHub pages, so we couldn't ever use them before). I had commented at length about this problem elsewhere in this repo in an issue (will look for it); but basically the difference is that categories seem to be an actual array of things under the name of your category that you can revisit rather than having to traverse every page on the whole site again and again and again. |
probably this comment and this followup |
I dug around and found this old description of the problem (and a solution) from Simon:
|
I was talking with Simon the other day. This is what he said:
It is not perfect (as you need to add translations manually) but I don't think that translations are added that often. (check raw file) |
Link is broken since that repository does not exist anymore. Here is a mirror: https://github.com/dwijnand/scala-lang/blob/soc/documentation/tutorial/java/index.md |
Another thing we can do: if there is some kind of Jekyll plugin that'll help us speed things up, we could consider building/serving docs.scala-lang.org on an EPFL machine. Both hosting on GitHub and hosting on EPFL machines have their drawbacks, but one relative benefit of running on EPFL infrastructure is our ability to use stuff like plugins. Just brainstorming. |
Per @dragos's suggestion, this commit implements a new approach to generate table of contents that uses internally populated Jekyll data structures to speed up listing and matching posts that are from the same category. As categories are only populated by posts and our current tutorials are pages, this commits turns pages into posts and makes sure that their permalinks correspond to the current ones. Build times are now around two minutes, see the following profile information from Jekyll: ``` jvican in /data/rw/code/scala/scala.github.com [11:02:40] > $ bundle exec jekyll serve --profile [±drone-integration ●●●] Configuration file: /data/rw/code/scala/scala.github.com/_config.yml Configuration file: /data/rw/code/scala/scala.github.com/_config.yml Source: /data/rw/code/scala/scala.github.com Destination: /data/rw/code/scala/scala.github.com/_site Incremental build: disabled. Enable with --incremental Generating... Filename | Count | Bytes | Time -------------------------------------------------------------------+-------+-----------+------- _layouts/overview-large.html | 164 | 26568.57K | 92.778 _includes/toc-large.txt | 164 | 23156.00K | 88.934 _layouts/tutorial.html | 199 | 3005.98K | 1.350 _layouts/overview.html | 37 | 1190.86K | 0.953 _includes/tutorial-toc.txt | 199 | 267.11K | 0.455 es/overviews/index.md | 1 | 46.66K | 0.443 _includes/localized-overview-index.txt | 1 | 46.49K | 0.443 _includes/tutorial-tour-list.txt | 200 | 244.89K | 0.432 _includes/header.txt | 439 | 2114.25K | 0.347 _layouts/cheatsheet.html | 6 | 225.08K | 0.217 _includes/cheatsheet-sidebar.txt | 6 | 42.70K | 0.207 style/index.md | 1 | 68.00K | 0.184 _includes/footer.txt | 449 | 855.91K | 0.175 tutorials/index.md | 1 | 54.34K | 0.168 _includes/footerbar.txt | 458 | 767.51K | 0.116 _includes/topbar.txt | 419 | 822.04K | 0.110 _includes/pager.txt | 363 | 27.10K | 0.079 _layouts/sip.html | 29 | 626.83K | 0.079 _layouts/guides-index.html | 4 | 55.73K | 0.069 _includes/disqus.txt | 386 | 324.89K | 0.044 _layouts/sip-landing.html | 10 | 171.17K | 0.038 _includes/toc.txt | 66 | 17.62K | 0.034 _layouts/default.html | 261 | 29198.78K | 0.030 _includes/allsids.txt | 10 | 17.88K | 0.019 _layouts/index.html | 7 | 261.62K | 0.011 _includes/sips-topbar.txt | 39 | 31.73K | 0.008 sips/pending/_posts/2016-01-11-static-members.md | 1 | 10.23K | 0.004 _includes/index-header.txt | 7 | 53.96K | 0.004 _includes/cheatsheet-header.txt | 6 | 57.92K | 0.003 _layouts/contribute.html | 1 | 21.40K | 0.003 _includes/frontpage-footer.txt | 9 | 15.29K | 0.003 sips/sip-list.md | 1 | 3.19K | 0.003 sips/completed/_posts/2016-06-25-trailing-commas.md | 1 | 10.62K | 0.002 _layouts/news-coursera.html | 1 | 26.31K | 0.002 _layouts/frontpage.html | 1 | 13.17K | 0.002 _layouts/page.html | 1 | 14.69K | 0.002 _layouts/glossary.html | 1 | 65.08K | 0.002 _layouts/search.html | 1 | 12.77K | 0.002 _includes/contributing-header.txt | 2 | 12.13K | 0.001 sips/minutes-list.md | 1 | 0.76K | 0.001 ja/overviews/collections/concrete-mutable-collection-classes.md | 1 | 13.02K | 0.001 overviews/collections/concrete-mutable-collection-classes.md | 1 | 11.09K | 0.001 ja/overviews/collections/overview.md | 1 | 8.73K | 0.001 _includes/header-coursera.txt | 1 | 5.21K | 0.001 _includes/frontpage-header.txt | 1 | 4.94K | 0.001 es/overviews/parallel-collections/concrete-parallel-collections.md | 1 | 13.97K | 0.001 overviews/parallel-collections/concrete-parallel-collections.md | 1 | 12.57K | 0.001 sips/sip-template.md | 1 | 4.30K | 0.001 overviews/collections/concrete-immutable-collection-classes.md | 1 | 14.17K | 0.001 _includes/glossary-header.txt | 1 | 10.10K | 0.001 done in 123.422 seconds. ```
Fix #607: Improve build times drastically
yay!!! 🎉 |
All the time is spent in several nested loops computing the table of contents for tutorials. Unfortunately Liquid is a pretty poor language so there aren't any obvious workarounds, but it's definitely worth investigating. Once I commented those loops times went down to around 1s.
Maybe a solution using categories or tags would reduce the number of iterations (350 pages, but only 33 are part of the Scala tour).
The text was updated successfully, but these errors were encountered: