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

perf(gatsby-adapter-netlify): improve adapt() performance #38988

Merged
merged 5 commits into from
May 29, 2024

Conversation

pieh
Copy link
Contributor

@pieh pieh commented May 22, 2024

Description

Adapter was regenerating _headers content for each static route in routes manifest which was resulting in really poor performance with large sites, this fixes it to generate _headers content only once.

Some measurements of impact on adapt() perf (I temporarily added timer for that - it is not part of this PR) on test site

before:

success [gatsby-adapter-netlify] adapt() - 92.711s

after:

success [gatsby-adapter-netlify] adapt() - 0.050s

The changes can be tested using canary releases:

gatsby@headers-perf
gatsby-adapter-netlify@headers-perf

Tests

Adapter tests and in particular header tests continue to pass. Added some adjustments to fixture (and some test updates), but they are not changing what was asserted before - just adding to them with additional case of headers rules for subset of pages which happen to be SSG

Related Issues

FRA-303

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 22, 2024
@pieh pieh removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 22, 2024
@pieh pieh force-pushed the perf/netlify-adapter-headers-redirects branch from 126f69c to b217a0e Compare May 23, 2024 07:13
@pieh pieh force-pushed the perf/netlify-adapter-headers-redirects branch from b217a0e to c7c750b Compare May 23, 2024 07:56
@pieh pieh force-pushed the perf/netlify-adapter-headers-redirects branch from 9b17cb7 to d02cb5c Compare May 23, 2024 10:30
@pieh pieh changed the title [wip] perf(gatsby-adapter-netlify): improve adapt() performance perf(gatsby-adapter-netlify): improve adapt() performance May 28, 2024
@pieh pieh marked this pull request as ready for review May 28, 2024 13:29
@pieh pieh merged commit ec77bed into master May 29, 2024
34 of 35 checks passed
@pieh pieh deleted the perf/netlify-adapter-headers-redirects branch May 29, 2024 08:00
pieh added a commit that referenced this pull request May 29, 2024
* test: add ssg specific headers

* fix: headers rule matching with path prefix

* test: add NODE_NO_WARNING, axios seems to use fetch now under the hood causing fetch warning on node 18 impacting some logs assertions

* perf: don't recreate headers from headerRoutes for each static route in route manifest

* test: apply NODE_NO_WARNINGS env in correct place

(cherry picked from commit ec77bed)
pieh added a commit that referenced this pull request May 29, 2024
* test: add ssg specific headers

* fix: headers rule matching with path prefix

* test: add NODE_NO_WARNING, axios seems to use fetch now under the hood causing fetch warning on node 18 impacting some logs assertions

* perf: don't recreate headers from headerRoutes for each static route in route manifest

* test: apply NODE_NO_WARNINGS env in correct place

(cherry picked from commit ec77bed)
pieh added a commit that referenced this pull request May 29, 2024
…38991)

* perf(gatsby-adapter-netlify): improve adapt() performance (#38988)

* test: add ssg specific headers

* fix: headers rule matching with path prefix

* test: add NODE_NO_WARNING, axios seems to use fetch now under the hood causing fetch warning on node 18 impacting some logs assertions

* perf: don't recreate headers from headerRoutes for each static route in route manifest

* test: apply NODE_NO_WARNINGS env in correct place

(cherry picked from commit ec77bed)

* chore: update caniuse-lite db

---------

Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
@pieh
Copy link
Contributor Author

pieh commented May 29, 2024

Released in

 - gatsby-adapter-netlify@1.1.6
 - gatsby@5.13.6

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

Successfully merging this pull request may close these issues.

2 participants