Skip to content

Commit f1082fe

Browse files
committed
perf: use up to 6 threads by default
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>
1 parent a21e714 commit f1082fe

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎.changeset/six-threads.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@doc-kit/core': minor
3+
---
4+
5+
Builds use up to 6 threads by default, instead of 4: with generators streaming into each other, more threads now pay off. On the Node.js API docs, the site build is ~15% faster at 6 threads than at 4, for ~20% more memory, while 8 threads were no faster than 6. `--threads` still sets any count.

‎docs/configuration.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ these for that generator alone, except `markdown`, which it adds to.
134134
Top-level, alongside `target` and `global`:
135135

136136
- `threads` {number} Worker threads used for generation. Defaults to your
137-
CPU count. Each worker's heap is limited to 512MB; to raise the limit, run
137+
CPU count, up to 6. Each worker's heap is limited to 512MB; to raise the limit, run
138138
Node.js with `--max-old-space-size` (directly or through `NODE_OPTIONS`).
139139
- `chunkSize` {number} Items processed per worker thread. **Default:** `10`.
140140

‎packages/core/src/threading/constants.mjs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
/**
44
* The default `threads` ceiling. Each worker holds a heap of its own, with the
55
* libraries and the pages it is working on, so past a few threads memory, not
6-
* CPU, is what runs out. `--threads` raises it.
6+
* CPU, is what runs out: on the Node.js docs, 8 threads were no faster than 6,
7+
* for ~15% more memory. `--threads` raises it.
78
*/
8-
export const DEFAULT_MAX_THREADS = 4;
9+
export const DEFAULT_MAX_THREADS = 6;
910

1011
/**
1112
* The heap size limit of each worker thread (V8's old space), in MB. V8 lets a

0 commit comments

Comments
 (0)