-
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(gatsby-plugin-mdx): drop another babel step during sourcing #25757
Conversation
Your pull request can be previewed in Gatsby Cloud: https://build-f6cd8712-5b60-41c9-8ad7-d02c4ce28176.staging-previews.gtsb.io |
This comment has been minimized.
This comment has been minimized.
7299f00
to
89b1d4e
Compare
} | ||
|
||
mdxNode.frontmatter = { | ||
title: ``, // always include a title | ||
...frontmatter, | ||
} | ||
|
||
mdxNode.excerpt = frontmatter.excerpt | ||
mdxNode.exports = nodeExports | ||
mdxNode.rawBody = content | ||
|
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.
This part is only refactoring, trying to create the object in one go rather than add properties to it later.
createParentChildLink({ parent: node, child: mdxNode }) | ||
|
||
// write scope files into .cache for later consumption | ||
const { scopeImports, scopeIdentifiers } = await findImports({ |
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.
This call is folded up inside createMDXNode
, where it replaces a babel parse step because it gives us the same result (that's the real change in this PR).
This Babel step was used to get exports and remark header but we can use the mdast for this purpose, just like for imports. See PR for perf numbers but they are big.
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.
This looks reasonable and the e2e mdx tests are passing, so that seems like a positive sign.
I found one stray character, but I'll also wait for John to chime in.
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.
✨ This lgtm!
I believe concerns have been addressed
This PR was rebverted due to breaking undocumented API's that were depended on by third parties anyways. That was fixed and the gist of this PR was merged again in #26002 |
This Babel step was used to get exports and remark header but we can use the mdast for this purpose, just like for imports.
The numbers
The following numbers are comparing this branch vs its base branch ([email protected]) on a dedicated nuc. The benchmark site will randomly generate the requested number of page files, will all look something like this:
Based on that here are the numbers (in truncated seconds):