Skip to content
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

Reduce wai-website build time #1077

Open
kfranqueiro opened this issue Feb 13, 2025 · 3 comments
Open

Reduce wai-website build time #1077

kfranqueiro opened this issue Feb 13, 2025 · 3 comments

Comments

@kfranqueiro
Copy link
Contributor

kfranqueiro commented Feb 13, 2025

Jekyll currently takes over 2 minutes to run in this repo. This impacts not only PR and deployment builds, but also individual builds when running in local development, which can slow down local testing considerably.

Running with --profile, the following files show up at the top of the list:

Filename Count Bytes Time
jekyll-remote-theme-20250213-171627-r1u8ie/_layouts/translation-sitemap.html 12 1409.83K 45.259
jekyll-remote-theme-20250213-171627-r1u8ie/_includes/t-status.html 1512 1051.42K 44.189
jekyll-remote-theme-20250213-171627-r1u8ie/_layouts/default.html 733 25559.32K 29.447
_layouts/act_rule.html 156 6535.36K 18.806
jekyll-remote-theme-20250213-171627-r1u8ie/_includes/secondarynav.html 743 3582.72K 15.318
assets/search/tipuesearch_content.js 1 8396.22K 12.939
jekyll-remote-theme-20250213-171627-r1u8ie/_includes/menuitem.html 28325 8022.36K 9.832
jekyll-remote-theme-20250213-171627-r1u8ie/_includes/link.html 3441 404.30K 7.751
jekyll-remote-theme-20250213-171627-r1u8ie/_includes/header.html 803 4787.21K 7.162
jekyll-remote-theme-20250213-171627-r1u8ie/_layouts/standalone_resource.html 352 16863.55K 5.608
pages/about/translating/resources.md 1 28.60K 2.437
  • Most of the files at the top of the list are located in wai-website-theme
  • Much of the time is spent in templates related to translations and/or site navigation. There are likely opportunities to use include_cached in more places where we aren't yet.
  • A lot of time is also spent in the default layout; to be fair, it is run many hundreds of times and is a big file. There may be some more includes we can cache in it. (It's also possible that part of its time is in common with other includes in this list, as it is between translation-sitemap and t-status.)
  • I'm not sure if much can be done about the act_rule.html layout (19 seconds for 156 runs) - I don't see any includes in it. Maybe there are a few pieces we can meaningfully break into cached includes?
  • I wonder if tipuesearch_content.js can be converted to a plugin and if that would speed up its generation? (I realize this is entirely a third-party file, but a single run of it accounts for 13 seconds in itself...)
    • Given that the file in question contains practically a carbon copy of the entire site's content, this may be unavoidable, aside from maybe adding logic to skip it in local dev.
  • Remi has mentioned there being potential room for simplification and further caching within navigation includes

Hacky workaround

In the interim, I created a branch on my fork of wai-website-theme which can reduce the build time by almost a full minute if you do not need the translation sitemaps or tipue search. It can be used by updating the remote_theme line in _config.yml (don't commit this change):

remote_theme: kfranqueiro/wai-website-theme@kgf-build-times

Even then, it still arguably takes an unreasonably long time. Ideally, the build should take well under one minute (or at least incremental builds should), but I'm not sure that much of an improvement is feasible with the amount of content and the current architecture.

@remibetin
Copy link
Member

remibetin commented Feb 13, 2025

One important limit to keep in mind when we want to address that, from jekyll-include-cache README:

For Jekyll Include Cache to work, you cannot rely on the page context to pass variables to your include (e.g., assign foo=bar or page.title). Instead, you must explicitly pass all variables to the include as arguments, and reference them within the include as include.foo (instead of page.foo or just foo).

This sometimes explains why include is used instead of include_cache. Although I think we could explicitly pass the missing variables in many cases, e.g. within navigation includes as you mentionned.

@remibetin
Copy link
Member

Much of the time is spent in templates related to translations

About this part, we may reconsider how suggested translation priorities for each language are featured. This could be an alternative path to refactoring the existing translation sitemaps.

@remibetin
Copy link
Member

I wonder if tipuesearch_content.js can be converted to a plugin and if that would speed up its generation? (I realize this is entirely a third-party file, but a single run of it accounts for 13 seconds in itself...)

Tipuesearch also plays a role in the repository size: see #771 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants