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

benchmark impact of mdx parsing code #10471

Closed
wants to merge 2 commits into from
Closed

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Sep 2, 2024

Motivation

This PR is not meant to be merged. It serves as history to document the build time impact of MDX parsing time (excluding remark plugin processing).

We compare the bundle time of regular mdx vs mdx that runs against a representative pre-parsed static tree.

This is not an accurate benchmark, but gives interesting numbers when using hyperfine:

yarn clear && yarn install
hyperfine --prepare 'yarn clear:website' --runs 3 'DOCUSAURUS_AB_BENCHMARK=false yarn build:website:fast' 'DOCUSAURUS_AB_BENCHMARK=true yarn build:website:fast'
hyperfine --prepare 'yarn clear:website' --runs 3 'DOCUSAURUS_AB_BENCHMARK=false yarn build:website:fast' 'DOCUSAURUS_AB_BENCHMARK=true yarn build:website:fast'
Benchmark 1: DOCUSAURUS_AB_BENCHMARK=false yarn build:website:fast
  Time (mean ± σ):     34.518 s ±  0.316 s    [User: 58.098 s, System: 9.194 s]
  Range (min … max):   34.174 s … 34.796 s    3 runs

Benchmark 2: DOCUSAURUS_AB_BENCHMARK=true yarn build:website:fast
  Time (mean ± σ):     31.563 s ±  0.428 s    [User: 50.612 s, System: 7.667 s]
  Range (min … max):   31.120 s … 31.974 s    3 runs

Summary
  DOCUSAURUS_AB_BENCHMARK=true yarn build:website:fast ran
    1.09 ± 0.02 times faster than DOCUSAURUS_AB_BENCHMARK=false yarn build:website:fast

My intuition: there's an impact, but it's probably not significant enough to justify migrating the MDX parsing to Rust (see related discussion: mdx-js/mdx#2529)

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Sep 2, 2024
@slorber slorber closed this Sep 2, 2024
@slorber slorber reopened this Sep 2, 2024
@slorber slorber added the pr: internal This PR does not touch production code, or is not meaningful enough to be in the changelog. label Sep 2, 2024
@slorber slorber closed this Sep 2, 2024
Copy link

netlify bot commented Sep 2, 2024

[V2]

Name Link
🔨 Latest commit 4ccff4c
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/66d5ec39f791490008a6dd9d
😎 Deploy Preview https://deploy-preview-10471--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

github-actions bot commented Sep 2, 2024

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO Report
/ 🟠 81 🟢 98 🟢 96 🟢 100 Report
/docs/installation 🟠 57 🟢 97 🟢 100 🟢 100 Report
/docs/category/getting-started 🟠 74 🟢 100 🟢 100 🟠 86 Report
/blog 🟠 64 🟢 96 🟢 100 🟠 86 Report
/blog/preparing-your-site-for-docusaurus-v3 🔴 47 🟢 92 🟢 100 🟢 100 Report
/blog/tags/release 🟠 64 🟢 96 🟢 100 🟠 86 Report
/blog/tags 🟠 74 🟢 100 🟢 100 🟠 86 Report

Copy link

github-actions bot commented Sep 2, 2024

Size Change: -10.4 MB (-90%) 🏆

Total Size: 1.15 MB

Filename Size Change
website/build/blog.html 0 B -61.4 kB (removed) 🏆
website/build/blog/2017/12/14/introducing-docusaurus.html 0 B -74.8 kB (removed) 🏆
website/build/blog/2018/04/30/How-I-Converted-Profilo-To-Docusaurus.html 0 B -47.3 kB (removed) 🏆
website/build/blog/2018/09/11/Towards-Docusaurus-2.html 0 B -51.7 kB (removed) 🏆
website/build/blog/2018/12/14/Happy-First-Birthday-Slash.html 0 B -30.4 kB (removed) 🏆
website/build/blog/2019/12/30/docusaurus-2019-recap.html 0 B -39.6 kB (removed) 🏆
website/build/blog/2020/01/07/tribute-to-endi.html 0 B -34 kB (removed) 🏆
website/build/blog/2021/01/19/docusaurus-2020-recap.html 0 B -48.9 kB (removed) 🏆
website/build/blog/2021/03/09/releasing-docusaurus-i18n.html 0 B -45.1 kB (removed) 🏆
website/build/blog/2021/05/12/announcing-docusaurus-two-beta.html 0 B -47.5 kB (removed) 🏆
website/build/blog/2021/11/21/algolia-docsearch-migration.html 0 B -52.9 kB (removed) 🏆
website/build/blog/2022/01/24/docusaurus-2021-recap.html 0 B -44.5 kB (removed) 🏆
website/build/blog/2022/08/01/announcing-docusaurus-2.0.html 0 B -139 kB (removed) 🏆
website/build/blog/2022/09/01/docusaurus-2.1.html 0 B -50.9 kB (removed) 🏆
website/build/blog/archive.html 0 B -24.7 kB (removed) 🏆
website/build/blog/authors.html 0 B -46.5 kB (removed) 🏆
website/build/blog/authors/j-marcey.html 0 B -65 kB (removed) 🏆
website/build/blog/authors/josh-cena.html 0 B -43 kB (removed) 🏆
website/build/blog/authors/lex-111.html 0 B -50.2 kB (removed) 🏆
website/build/blog/authors/slorber.html 0 B -61.5 kB (removed) 🏆
website/build/blog/authors/slorber/authors/2.html 0 B -65.4 kB (removed) 🏆
website/build/blog/authors/slorber/authors/3.html 0 B -77.7 kB (removed) 🏆
website/build/blog/authors/slorber/authors/4.html 0 B -44.7 kB (removed) 🏆
website/build/blog/authors/yangshun.html 0 B -57.8 kB (removed) 🏆
website/build/blog/authors/zpao.html 0 B -43.5 kB (removed) 🏆
website/build/blog/page/2.html 0 B -66 kB (removed) 🏆
website/build/blog/page/3.html 0 B -71.7 kB (removed) 🏆
website/build/blog/page/4.html 0 B -64.2 kB (removed) 🏆
website/build/blog/page/5.html 0 B -41.9 kB (removed) 🏆
website/build/blog/preparing-your-site-for-docusaurus-v3.html 0 B -138 kB (removed) 🏆
website/build/blog/releases/2.2.html 0 B -49.6 kB (removed) 🏆
website/build/blog/releases/2.3.html 0 B -60.8 kB (removed) 🏆
website/build/blog/releases/2.4.html 0 B -65.3 kB (removed) 🏆
website/build/blog/releases/3.0.html 0 B -111 kB (removed) 🏆
website/build/blog/releases/3.1.html 0 B -52 kB (removed) 🏆
website/build/blog/releases/3.2.html 0 B -48.8 kB (removed) 🏆
website/build/blog/releases/3.3.html 0 B -55.5 kB (removed) 🏆
website/build/blog/releases/3.4.html 0 B -55.8 kB (removed) 🏆
website/build/blog/releases/3.5.html 0 B -58 kB (removed) 🏆
website/build/blog/tags.html 0 B -28.6 kB (removed) 🏆
website/build/blog/upgrading-frontend-dependencies-with-confidence-using-visual-regression-testing.html 0 B -128 kB (removed) 🏆
website/build/docs.html 0 B -49.4 kB (removed) 🏆
website/build/docs/advanced.html 0 B -31.1 kB (removed) 🏆
website/build/docs/advanced/architecture.html 0 B -30.7 kB (removed) 🏆
website/build/docs/advanced/client.html 0 B -76 kB (removed) 🏆
website/build/docs/advanced/plugins.html 0 B -58.6 kB (removed) 🏆
website/build/docs/advanced/routing.html 0 B -73.9 kB (removed) 🏆
website/build/docs/advanced/ssg.html 0 B -81.5 kB (removed) 🏆
website/build/docs/api/docusaurus-config.html 0 B -202 kB (removed) 🏆
website/build/docs/api/misc/@docusaurus/eslint-plugin.html 0 B -48.3 kB (removed) 🏆
website/build/docs/api/misc/@docusaurus/eslint-plugin/no-html-links.html 0 B -38.1 kB (removed) 🏆
website/build/docs/api/misc/@docusaurus/eslint-plugin/no-untranslated-text.html 0 B -37 kB (removed) 🏆
website/build/docs/api/misc/@docusaurus/eslint-plugin/prefer-docusaurus-heading.html 0 B -38.3 kB (removed) 🏆
website/build/docs/api/misc/@docusaurus/eslint-plugin/string-literal-i18n-messages.html 0 B -41.9 kB (removed) 🏆
website/build/docs/api/misc/@docusaurus/logger.html 0 B -39.8 kB (removed) 🏆
website/build/docs/api/misc/create-docusaurus.html 0 B -34.9 kB (removed) 🏆
website/build/docs/api/plugin-methods.html 0 B -67.4 kB (removed) 🏆
website/build/docs/api/plugin-methods/extend-infrastructure.html 0 B -63 kB (removed) 🏆
website/build/docs/api/plugin-methods/i18n-lifecycles.html 0 B -60.7 kB (removed) 🏆
website/build/docs/api/plugin-methods/lifecycle-apis.html 0 B -170 kB (removed) 🏆
website/build/docs/api/plugin-methods/static-methods.html 0 B -46.5 kB (removed) 🏆
website/build/docs/api/plugins.html 0 B -31.7 kB (removed) 🏆
website/build/docs/api/plugins/@docusaurus/plugin-client-redirects.html 0 B -62.6 kB (removed) 🏆
website/build/docs/api/plugins/@docusaurus/plugin-content-blog.html 0 B -198 kB (removed) 🏆
website/build/docs/api/plugins/@docusaurus/plugin-content-docs.html 0 B -202 kB (removed) 🏆
website/build/docs/api/plugins/@docusaurus/plugin-content-pages.html 0 B -78 kB (removed) 🏆
website/build/docs/api/plugins/@docusaurus/plugin-debug.html 0 B -50.5 kB (removed) 🏆
website/build/docs/api/plugins/@docusaurus/plugin-google-analytics.html 0 B -51.5 kB (removed) 🏆
website/build/docs/api/plugins/@docusaurus/plugin-google-gtag.html 0 B -51 kB (removed) 🏆
website/build/docs/api/plugins/@docusaurus/plugin-google-tag-manager.html 0 B -49.8 kB (removed) 🏆
website/build/docs/api/plugins/@docusaurus/plugin-ideal-image.html 0 B -51.1 kB (removed) 🏆
website/build/docs/api/plugins/@docusaurus/plugin-pwa.html 0 B -122 kB (removed) 🏆
website/build/docs/api/plugins/@docusaurus/plugin-sitemap.html 0 B -68.5 kB (removed) 🏆
website/build/docs/api/plugins/@docusaurus/plugin-vercel-analytics.html 0 B -42.2 kB (removed) 🏆
website/build/docs/api/themes.html 0 B -30.4 kB (removed) 🏆
website/build/docs/api/themes/@docusaurus/theme-classic.html 0 B -46.4 kB (removed) 🏆
website/build/docs/api/themes/@docusaurus/theme-live-codeblock.html 0 B -38.6 kB (removed) 🏆
website/build/docs/api/themes/@docusaurus/theme-mermaid.html 0 B -37.5 kB (removed) 🏆
website/build/docs/api/themes/@docusaurus/theme-search-algolia.html 0 B -34.7 kB (removed) 🏆
website/build/docs/api/themes/configuration.html 0 B -256 kB (removed) 🏆
website/build/docs/blog.html 0 B -219 kB (removed) 🏆
website/build/docs/browser-support.html 0 B -51 kB (removed) 🏆
website/build/docs/category/getting-started.html 0 B -28.3 kB (removed) 🏆
website/build/docs/category/guides.html 0 B -36.4 kB (removed) 🏆
website/build/docs/cli.html 0 B -63.8 kB (removed) 🏆
website/build/docs/configuration.html 0 B -98.5 kB (removed) 🏆
website/build/docs/create-doc.html 0 B -65.3 kB (removed) 🏆
website/build/docs/creating-pages.html 0 B -59.1 kB (removed) 🏆
website/build/docs/deployment.html 0 B -211 kB (removed) 🏆
website/build/docs/docs-introduction.html 0 B -53.6 kB (removed) 🏆
website/build/docs/docs-multi-instance.html 0 B -78.7 kB (removed) 🏆
website/build/docs/docusaurus-core.html 0 B -245 kB (removed) 🏆
website/build/docs/guides/whats-next.html 0 B -32.8 kB (removed) 🏆
website/build/docs/i18n/crowdin.html 0 B -151 kB (removed) 🏆
website/build/docs/i18n/git.html 0 B -82.7 kB (removed) 🏆
website/build/docs/i18n/introduction.html 0 B -50.8 kB (removed) 🏆
website/build/docs/i18n/tutorial.html 0 B -171 kB (removed) 🏆
website/build/docs/installation.html 0 B -73 kB (removed) 🏆
website/build/docs/introduction/index.html 0 B -280 B (removed) 🏆
website/build/docs/markdown-features.html 0 B -83.2 kB (removed) 🏆
website/build/docs/markdown-features/admonitions.html 0 B -119 kB (removed) 🏆
website/build/docs/markdown-features/assets.html 0 B -93.5 kB (removed) 🏆
website/build/docs/markdown-features/code-blocks.html 0 B -245 kB (removed) 🏆
website/build/docs/markdown-features/diagrams.html 0 B -56 kB (removed) 🏆
website/build/docs/markdown-features/head-metadata.html 0 B -52.8 kB (removed) 🏆
website/build/docs/markdown-features/links.html 0 B -43.1 kB (removed) 🏆
website/build/docs/markdown-features/math-equations.html 0 B -95.4 kB (removed) 🏆
website/build/docs/markdown-features/plugins.html 0 B -101 kB (removed) 🏆
website/build/docs/markdown-features/react.html 0 B -144 kB (removed) 🏆
website/build/docs/markdown-features/tabs.html 0 B -148 kB (removed) 🏆
website/build/docs/markdown-features/toc.html 0 B -88.8 kB (removed) 🏆
website/build/docs/migration.html 0 B -43 kB (removed) 🏆
website/build/docs/migration/v2.html 0 B -41.3 kB (removed) 🏆
website/build/docs/migration/v2/automated.html 0 B -42.6 kB (removed) 🏆
website/build/docs/migration/v2/manual.html 0 B -207 kB (removed) 🏆
website/build/docs/migration/v2/translated-sites.html 0 B -52.8 kB (removed) 🏆
website/build/docs/migration/v2/versioned-sites.html 0 B -67.2 kB (removed) 🏆
website/build/docs/migration/v3.html 0 B -218 kB (removed) 🏆
website/build/docs/playground.html 0 B -32.5 kB (removed) 🏆
website/build/docs/resources/index.html 0 B -325 B (removed) 🏆
website/build/docs/search.html 0 B -121 kB (removed) 🏆
website/build/docs/seo.html 0 B -93 kB (removed) 🏆
website/build/docs/sidebar.html 0 B -136 kB (removed) 🏆
website/build/docs/sidebar/autogenerated.html 0 B -156 kB (removed) 🏆
website/build/docs/sidebar/items.html 0 B -188 kB (removed) 🏆
website/build/docs/sidebar/multiple-sidebars.html 0 B -67.1 kB (removed) 🏆
website/build/docs/static-assets.html 0 B -56.3 kB (removed) 🏆
website/build/docs/styling-layout.html 0 B -141 kB (removed) 🏆
website/build/docs/support/index.html 0 B -319 B (removed) 🏆
website/build/docs/swizzling.html 0 B -120 kB (removed) 🏆
website/build/docs/team/index.html 0 B -310 B (removed) 🏆
website/build/docs/typescript-support.html 0 B -65.4 kB (removed) 🏆
website/build/docs/using-plugins.html 0 B -115 kB (removed) 🏆
website/build/docs/versioning.html 0 B -87.1 kB (removed) 🏆
website/build/index.html 0 B -37.8 kB (removed) 🏆
ℹ️ View Unchanged
Filename Size
website/.docusaurus/codeTranslations.json 2 B
website/.docusaurus/docusaurus.config.mjs 27.9 kB
website/.docusaurus/globalData.json 30.2 kB
website/.docusaurus/i18n.json 930 B
website/.docusaurus/registry.js 155 kB
website/.docusaurus/routes.js 74.3 kB
website/.docusaurus/routesChunkNames.json 81.7 kB
website/.docusaurus/site-metadata.json 2.17 kB
website/build/assets/css/styles.********.css 113 kB
website/build/assets/js/main.********.js 666 kB

compressed-size-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: internal This PR does not touch production code, or is not meaningful enough to be in the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants