Skip to content

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

Merged
avivkeller merged 3 commits into
mainfrom
perf/six-threads
Nov 28, 2026
Merged

avivkeller merged 3 commits into
mainfrom
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. The CPUs are counted with os.availableParallelism(), so a container's CPU limit lowers the default. 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 28, 2026 9:53pm 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 93.99%. Comparing base (b382b73) to head (292469b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1243   +/-   ##
=======================================
  Coverage   93.99%   93.99%           
=======================================
  Files         301      301           
  Lines       31519    31520    +1     
  Branches     3216     3216           
=======================================
+ Hits        29626    29627    +1     
  Misses       1871     1871           
  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 ↗ 292469b 2026-11-28T21:53:50.003Z View logs ↗
  • Build: Failed ❌

View logs ↗
a5b491f 2026-11-28T21:52:57.172Z View logs ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ bc94a37 2026-11-28T21:51:02.053Z View logs ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 06fd956 2026-11-28T21:29:39.866Z View logs ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ a632a90 2026-11-28T03:28:43.859Z View logs ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 8b55d18 2026-11-27T20:16:20.010Z View logs ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 752f1bb 2026-11-27T19:50:01.891Z View logs ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 80f85f3 2026-11-23T18:18:46.859Z View logs ↗
  • 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 ↗

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
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>
os.cpus() counts every CPU of the host, so in a container limited to 2
CPUs the default went from 4 workers to 6. os.availableParallelism()
honours CPU affinity and quotas, and gives the same count elsewhere.
The CLI docs said the default was up to 4 threads.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread .changeset/six-threads.md Resolved
Signed-off-by: Aviv Keller <me@aviv.sh>
@avivkeller
avivkeller enabled stacked auto-merge (squash) November 28, 2026 21:53
@avivkeller
avivkeller merged commit 3d1c428 into main Nov 28, 2026
25 checks passed
@avivkeller
avivkeller deleted the perf/six-threads branch November 28, 2026 21:54
@github-actions github-actions Bot mentioned this pull request Nov 28, 2026

This branch was successfully deployed

1 active deployment
Preview – api-docs-tooling — 292469bd Deployed Nov 28, 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