-
Notifications
You must be signed in to change notification settings - Fork 19
chore: increase performance of legacy generators #505
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #505 +/- ##
==========================================
- Coverage 74.60% 74.59% -0.02%
==========================================
Files 112 112
Lines 10700 10713 +13
Branches 722 722
==========================================
+ Hits 7983 7991 +8
- Misses 2714 2719 +5
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
83baee7 to
495bc4c
Compare
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.
Pull request overview
This PR improves performance of the legacy documentation generators by ~65% (from 40s to 14s) by optimizing Shiki syntax highlighting initialization and usage. The key change is splitting the getRemarkRehype() function into two variants: one without syntax highlighting (for JSON generation where highlighting isn't needed) and one with Shiki (for HTML generation where highlighting is required).
- Split
getRemarkRehype()into two functions to avoid unnecessary Shiki initialization in legacy-json generator - Enabled WebAssembly mode for Shiki highlighter via
wasm: trueoption - Updated legacy-html generators to use the new
getRemarkRehypeWithShiki()function
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/remark.mjs | Splits getRemarkRehype() into two functions: a lightweight version without Shiki and getRemarkRehypeWithShiki() with syntax highlighting support; also removes a TODO comment and reformats code |
| src/utils/highlighter.mjs | Adds wasm: true option to Shiki highlighter initialization for better performance and adds deprecation notice for the legacy highlighter function |
| src/generators/legacy-json/index.mjs | Minor whitespace formatting change |
| src/generators/legacy-html/index.mjs | Updates import and usage to use the new getRemarkRehypeWithShiki() function |
| src/generators/legacy-html-all/index.mjs | Updates import and usage to use the new getRemarkRehypeWithShiki() function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@nodejs/web-infra can this be considered a "bug fix" and be fast-tracked? 👍 if you're ok with that. |
This PR reduces
make doc-only -jfrom 40s~ to 14s~ on my machine.That's it.