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. Machines with fewer CPUs, like CI's 4, are unaffected, and --threads still sets any count.

Site build 4 threads 6 threads
With the stack 8.09s, 2159MB 7.09s (-12%), 2814MB (+30%)
main 9.82s, 1728MB 8.56s (-13%), 2280MB (+32%)

8 threads were no faster than 6, and used ~15% more memory.

Validation

With -p 1 under --max-old-space-size=512, the site build still passed all 11 runs at ~1000MB peak, and legacy all 3 at 877MB.

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.

@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 20, 2026 9:46pm 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.02%. Comparing base (6161190) to head (d35dd5c).

Additional details and impacted files
@@                Coverage Diff                 @@
##           refactor/html-all    #1243   +/-   ##
==================================================
  Coverage              94.02%   94.02%           
==================================================
  Files                    300      300           
  Lines                  31653    31654    +1     
  Branches                3219     3219           
==================================================
+ Hits                   29763    29764    +1     
  Misses                  1868     1868           
  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

cloudflare-workers-and-pages Bot commented Nov 3, 2026 •

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 ↗ d35dd5c 2026-11-20T21:46:43.826Z View logs ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ ecb016b 2026-11-18T03:38:51.364Z View logs ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 90054fe 2026-11-17T14:45:32.465Z View logs ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ b85c17f 2026-11-13T16:49:31.121Z View logs ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 589914f 2026-11-11T00:07:46.193Z View logs ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ c283664 2026-11-10T20:53:54.619Z View logs ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ d6f41cc 2026-11-09T13:26:28.458Z View logs ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ c4b0dc4 2026-11-09T11:04:29.752Z View logs ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 5624386 2026-11-09T10:38:13.644Z View logs ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ fd18bd4 2026-11-09T02:27:09.786Z View logs ↗

View all previews: View all previews ↗

@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
@bmuenzenmeyer

Copy link
Copy Markdown
Contributor

What about CI? The default is Math.min(cpus().length, 6). CI's ubuntu-latest runners have 4 CPUs, so CI keeps 4 workers and a 4-thread bundler, and the time and RSS in its comparison comment stay comparable with main's. riscv64 stays at 1, and #1253 runs with threads: 1, so it doesn't exercise this change.

Am I right to come to the conclusion this is a local (dev machine) optimization only then?

@ovflowd

ovflowd commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

Am I right to come to the conclusion this is a local (dev machine) optimization only then?

No. CI environments usually aren't single threaded either. But the conclusion here is use up to 6 threads (max) instead the default of 4 threads max. So systems with more threads, like Vercel, GHA, local PCs will build faster. Also more threads != needing more cores.

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>

This branch was successfully deployed

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

3 participants