Skip to content

Conversation

@ovflowd
Copy link
Member

@ovflowd ovflowd commented Dec 4, 2025

This PR reduces make doc-only -j from 40s~ to 14s~ on my machine.

  • Use WASM on the legacy generator
  • JSON generator shouldn't use Shiki

That's it.

Copilot AI review requested due to automatic review settings December 4, 2025 01:11
@ovflowd ovflowd requested a review from a team as a code owner December 4, 2025 01:11
@vercel
Copy link

vercel bot commented Dec 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
api-docs-tooling Ready Ready Preview Dec 4, 2025 1:14am

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

❌ Patch coverage is 48.00000% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.59%. Comparing base (c77ec50) to head (495bc4c).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/utils/remark.mjs 41.17% 10 Missing ⚠️
src/generators/legacy-html-all/index.mjs 50.00% 1 Missing ⚠️
src/generators/legacy-html/index.mjs 50.00% 1 Missing ⚠️
src/generators/legacy-json/index.mjs 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ovflowd ovflowd force-pushed the chore/performance-improvements branch from 83baee7 to 495bc4c Compare December 4, 2025 01:13
Copy link
Contributor

Copilot AI left a 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: true option
  • 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.

@ovflowd
Copy link
Member Author

ovflowd commented Dec 4, 2025

@nodejs/web-infra can this be considered a "bug fix" and be fast-tracked? 👍 if you're ok with that.

@ovflowd ovflowd added the fast track This PR can land before the typical review time, with a :+1: from collaborators label Dec 4, 2025
@ovflowd ovflowd merged commit 1e96be7 into main Dec 4, 2025
19 checks passed
@ovflowd ovflowd deleted the chore/performance-improvements branch December 4, 2025 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fast track This PR can land before the typical review time, with a :+1: from collaborators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants