-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
perf: use must-revalidate cache-control header as common and only create header routes for routes with different cache-control #38820
Merged
pieh
merged 2 commits into
master
from
perf/use-must-revalidate-cache-control-as-default-in-header-rules
Jan 25, 2024
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ate header routes for routes with different cache-control
gatsbot
bot
added
the
status: triage needed
Issue or pull request that need to be triaged and assigned to a reviewer
label
Jan 23, 2024
pieh
added
topic: performance
Related to runtime & build performance
topic: adapters
Related to Gatsby Adapters
and removed
status: triage needed
Issue or pull request that need to be triaged and assigned to a reviewer
labels
Jan 23, 2024
mraerino
approved these changes
Jan 24, 2024
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.
:gotta-parrot-fast: 🚀
kathmbeck
approved these changes
Jan 25, 2024
pieh
deleted the
perf/use-must-revalidate-cache-control-as-default-in-header-rules
branch
January 25, 2024 14:38
pieh
added a commit
that referenced
this pull request
Jan 25, 2024
…ate header routes for routes with different cache-control (#38820) (#38824) * perf: use must-revalidate cache-control header as common and only create header routes for routes with different cache-control * test: update headerRoutes unit tests (cherry picked from commit fb77fe5) Co-authored-by: Michal Piechowiak <[email protected]>
This was referenced Feb 16, 2024
This was referenced May 9, 2024
This was referenced May 16, 2024
This was referenced Oct 17, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
topic: adapters
Related to Gatsby Adapters
topic: performance
Related to runtime & build performance
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
before on left, with the change in the pr on right for sample reproduction with 10000 dummy pages (this is zoomed in on execution of just this line
gatsby/packages/gatsby-adapter-netlify/src/route-handler.ts
Lines 262 to 263 in 94b2482
Note that in above cpu profile biggest drain is actually way content of
_headers
file is produced and not necessarily amount of them (tho they both combined cause the problem). String concatenations for each route (gatsby/packages/gatsby-adapter-netlify/src/route-handler.ts
Line 242 in 94b2482
gatsby/packages/gatsby-adapter-netlify/src/route-handler.ts
Line 136 in 94b2482
acc += 'string-to-append'
we could push entries to array and finally to.join('')
on that array to produce final string, but this change alone seems to just mostly avoid hitting issues in the first placeIn practice (first reported time is just the build, and second is build + time spent in adapter handling):
before:
and after
this also result in much smaller
public/_headers
file as we no longer create entries for each html and page-data files - see https://www.diffchecker.com/VWVHsM5R/Documentation
Tests
Updated unit tests + https://github.com/gatsbyjs/gatsby/blob/master/e2e-tests/adapters/cypress/e2e/headers.cy.ts still passing
Related Issues