Skip to content

perf: use up to 6 threads by default - #1243

Open
ovflowd wants to merge 1 commit into
refactor/html-allfrom
perf/six-threads
Open

ovflowd wants to merge 1 commit into
refactor/html-allfrom
perf/six-threads

Conversation

@ovflowd

@ovflowd ovflowd commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Description

This PR makes builds use up to 6 threads by default, instead of 4. It's the last part of the stack that splits #1205. With generators streaming into each other, more threads now pay off: main only goes from 9.55s at 4 threads to 8.82s at 6, while with the stack the site build goes from 7.64s to 6.48s.

8 threads were no faster than 6 for the site build, and used ~15% more memory. Machines with fewer CPUs, like CI's 4, are unaffected, and --threads still sets any count.

Validation

Node.js's docs on Node.js 24, medians of 5 interleaved runs. The site is orama-db, json, llms-txt and section-pages (which pulls in jsx-ast and html), legacy is legacy-html-all and legacy-json-all. This column is the whole stack:

Threads main The stack
Site 4 9.55s, 1715MB 7.44s (-22%), 1867MB (+9%)
Site 6 8.82s, 2143MB 6.18s (-30%), 2309MB (+8%)
Legacy 4 4.57s, 1587MB 4.10s (-10%), 1540MB (-3%)
Legacy 6 4.17s, 2022MB 3.78s (-9%), 1886MB (-7%)

At the new default, against other thread counts:

4 threads 6 threads 8 threads
Site 7.64s, 1887MB 6.48s (-15%), 2281MB (+21%) 6.66s, 2655MB
Legacy 4.19s, 1538MB 3.96s (-5%), 1949MB 3.75s (-10%), 2273MB

-p 1 with --max-old-space-size=512 still passes, at ~1.0GB peak RSS.

Related Issues

Refs: #1205, and nodejs/nodejs.org#9253, which caches tokens for both themes and makes the site build faster still.

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.

With generators streaming into each other, more threads now pay off, so
DEFAULT_MAX_THREADS goes from 4 to 6. On the Node.js API docs the site
build is ~15% faster at 6 threads than at 4, for ~20% more memory;
8 threads were no faster than 6 and used ~15% more. Machines with fewer
CPUs, like CI's 4, are unaffected, and --threads still sets any count.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Sonnet 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 3, 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 Nov 3, 2026 7:36pm UTC

Request Review

@ovflowd
ovflowd added this pull request to stack #1244 November 3, 2026 19:34
@ovflowd ovflowd mentioned this pull request Nov 3, 2026
4 tasks done
@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.64%. Comparing base (a21e714) to head (f1082fe).

Additional details and impacted files
@@                Coverage Diff                 @@
##           refactor/html-all    #1243   +/-   ##
==================================================
  Coverage              94.64%   94.64%           
==================================================
  Files                    297      297           
  Lines                  31876    31877    +1     
  Branches                3243     3243           
==================================================
+ Hits                   30168    30169    +1     
  Misses                  1686     1686           
  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.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ f1082fe 2026-11-03T19:35:33.305Z View logs ↗

@ovflowd
ovflowd marked this pull request as ready for review November 3, 2026 20:39
@ovflowd
ovflowd requested a review from a team as a code owner November 3, 2026 20:39

This branch was successfully deployed

1 active deployment
Preview – api-docs-tooling — f1082fe2 Deployed Nov 3, 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.

2 participants