-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Optimise sitemap creation #26710
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
Optimise sitemap creation #26710
Conversation
| name: Build | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| ENABLE_LAST_MOD_IN_SITEMAP: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed anymore, as it's fast
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should wait to remove this until we've confirmed that across a couple builds. Making assumptions about what does / doesn't affect the build time is sorta how we got into the sitemap generation (and it's build time regression) situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I did benchmark a few scenarios locally though, and removing it here means it runs in this PR, which it wouldn't otherwise.
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
|
Preview URL: https://79cb50ab.preview.developers.cloudflare.com |
|
cc: @colbywhite |
colbywhite
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ascorbic , Thanks for the input. I'm currently working on this exact logic but was implementing it slightly differently to account for edge cases. Let's merge this for now and I'll refactor it later today.
Summary
The sitemap generator uses git to get the last modified time. Currently this execs git for every path, which is very slow – currently accounting for half of the build time. This PR optimises this by instead getting all of the last modified times with a single git log command, and caching them in a
Map. This reduces the time on my local machine from ~5 minutes to 400 ms, and in production from around 9 mins to ~800ms, cutting build time approximately in half.Screenshots (optional)
Documentation checklist