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-plugin-mdx): Use getNodesByType for plugin transformation #22555

Merged
merged 1 commit into from Mar 25, 2020

Conversation

johno
Copy link
Contributor

@johno johno commented Mar 24, 2020

Since getSourcePluginsAsRemarkPlugins is called on
every MDX file, the getNodes call became expensive
at scale with thousands of MDX files.

This was encountered when attempting to find
underlying issues for #22521. @pvdz had a hunch that
node traversal may be a culprit. This doesn't fully
address all underlying performance issues but
is a quick win.

8k MDX pages: 440s => 350s
16k MDX pages: 1100s => 750s

@johno johno requested a review from a team as a code owner March 24, 2020 23:00
pvdz
pvdz previously approved these changes Mar 24, 2020
Copy link
Contributor

@pvdz pvdz left a comment

Choose a reason for hiding this comment

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

Awesomesauce!

@pvdz pvdz added the bot: merge on green Gatsbot will merge these PRs automatically when all tests passes label Mar 24, 2020
Since getSourcePluginsAsRemarkPlugins is called on
every MDX file, the getNodes call became expensive
at scale with thousands of MDX files.

This was encountered when attempting to find
underlying issues for gatsbyjs#22521. @pvdz had a hunch that
node traversal may be a culprit. This doesn't fully
address all underlying performance issues but
is a quick win.

8k MDX pages: 440s => 350s
16k MDX pages: 1100s => 750s
@gatsbybot gatsbybot merged commit 63d091a into gatsbyjs:master Mar 25, 2020
@pvdz pvdz added the scaling label Mar 25, 2020
@pvdz pvdz changed the title fix(gatsby-plugin-mdx): Use getNodesByType for plugin transformation perf(gatsby-plugin-mdx): Use getNodesByType for plugin transformation Mar 25, 2020
@johno johno deleted the gatsby-plugin-mdx-perf branch March 25, 2020 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: merge on green Gatsbot will merge these PRs automatically when all tests passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants