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): Create page object & SitePage node in same action creator #31104

Merged
merged 28 commits into from May 4, 2021

Conversation

KyleAMathews
Copy link
Contributor

@KyleAMathews KyleAMathews commented Apr 28, 2021

An alt take to #30769 suggested by @pieh for speeding up / reducing memory usage when creating pages

The PR drops the createPages activity for 100k pages in the "create-pages" benchmark from 16s to 4.5s (~70% drop) and peak RSS memory from 1.4gb to 0.7gb (~50% drop). With forced GC, heap memory usage post createPages drops from 251mb -> 180mb (28% drop). Most of the memory drop comes I believe from being able to avoid calling onCreatePages. Many real-world sites won't be able to do this but some do and more in the future could if we create alternative patterns to common plugins implementing onCreatePage (e.g. https://www.gatsbyjs.com/plugins/gatsby-plugin-remove-trailing-slashes/?=trailin)

So not quite as dramatic of drop as not creating page nodes (nodes are significantly heavier to create both in CPU & memory than pages (though we cheat here and skip a lot of node creations steps)) but also doesn't have any breaking changes so overall it's much better.

[ch23792]

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Apr 28, 2021
@KyleAMathews KyleAMathews added topic: scaling builds and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Apr 28, 2021
@pieh pieh self-assigned this Apr 29, 2021
@KyleAMathews KyleAMathews changed the title feat(gatsby): Share object between page object & SitePage node feat(gatsby): Create page object & SitePage node in same action creator Apr 29, 2021
Drops 100k create-pages benchmark from ~8s to 4.5s as it means
we don't need to invoke `onCreatePage` by default.
pieh added 2 commits May 4, 2021 16:43
* fix 404

* drop checking defered node mutations when bailing

* suspend after first compilation
Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 🇮🇹

@pieh pieh changed the title feat(gatsby): Create page object & SitePage node in same action creator perf(gatsby): Create page object & SitePage node in same action creator May 4, 2021
@pieh pieh merged commit d1005fa into master May 4, 2021
@pieh pieh deleted the no-extra-site-page-nodes branch May 4, 2021 16:13
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

Successfully merging this pull request may close these issues.

None yet

2 participants