Skip to content

perf(legacy-html): stop re-parsing shiki themes per code block - #1169

Open
araujogui wants to merge 1 commit into
nodejs:mainfrom
araujogui:perf/legacy-html-shiki-themes
Open

araujogui wants to merge 1 commit into
nodejs:mainfrom
araujogui:perf/legacy-html-shiki-themes

Conversation

@araujogui

Copy link
Copy Markdown
Member

Description

legacy-html passed theme objects to codeToHast. Shiki normalizes them into new objects, so its theme cache never hits and both themes are re-parsed for every code block (~3.8s CPU per build). The highlighter now loads the catppuccin themes and code is highlighted with them by name, as highlighter.mjs already does.

Validation

legacy-html on the Node.js API docs, 8 cores, 3 runs:

wall CPU RSS
before 6.9–7.4s 33.4s ~1.45GB
after 4.8–5.0s 23.2s ~1.45GB

Output is byte-identical (diff -r over all 71 files). Tests, lint and format pass.

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have check code formatting with node --run format:check & node --run lint.
  • I've covered new added functionality with unit tests if necessary.

@araujogui
araujogui requested a review from a team as a code owner October 18, 2026 13:36
Copilot AI balanced review requested due to automatic review settings October 18, 2026 13:36
@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
api-docs-tooling Ready Ready Preview Oct 18, 2026 1:36pm UTC

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.44%. Comparing base (560c042) to head (e2d83b9).

Files with missing lines Patch % Lines
...ages/node-legacy/src/legacy-html/plugins/shiki.mjs 62.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1169      +/-   ##
==========================================
- Coverage   93.44%   93.44%   -0.01%     
==========================================
  Files         278      278              
  Lines       27815    27820       +5     
  Branches     2789     2790       +1     
==========================================
+ Hits        25993    25997       +4     
- Misses       1800     1801       +1     
  Partials       22       22              

☔ View full report in Codecov by Harness.
📢 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.

@github-actions

Copy link
Copy Markdown
Contributor

api-links Generator

Performance estimate (single CI run)

  • Generation time: 13.8% slower (650.00 ms → 740.00 ms)
  • Peak memory: 0.8% lower (302.18 MB → 299.64 MB)

json Generator

Performance estimate (single CI run)

  • Generation time: 25.9% slower (7.48 s → 9.42 s)
  • Peak memory: 2.2% higher (1.21 GB → 1.23 GB)

legacy-html Generator

Performance estimate (single CI run)

  • Generation time: 14.4% faster (14.67 s → 12.56 s)
  • Peak memory: 5.7% lower (1.84 GB → 1.73 GB)

legacy-json Generator

Performance estimate (single CI run)

  • Generation time: 50.7% slower (5.82 s → 8.77 s)
  • Peak memory: 8.8% lower (1.26 GB → 1.15 GB)

llms-txt Generator

Performance estimate (single CI run)

  • Generation time: 7.7% slower (7.57 s → 8.15 s)
  • Peak memory: 1.2% lower (1.14 GB → 1.13 GB)

orama-db Generator

Output size: 1 file changed · net -1.00 B

File size details
File Main PR Change
orama-db.json 29.15 MB 29.15 MB -1.00 B (-0.0%)

Performance estimate (single CI run)

  • Generation time: 8.8% faster (5.65 s → 5.15 s)
  • Peak memory: 3.5% higher (1.33 GB → 1.38 GB)

web Generator

Performance estimate (single CI run)

  • Generation time: 0.2% faster (24.88 s → 24.84 s)
  • Peak memory: 2.8% lower (2.04 GB → 1.99 GB)

@ovflowd ovflowd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

SGTM

This branch was successfully deployed

1 active deployment
Preview – api-docs-tooling — e2d83b94 Deployed Oct 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants