Skip to content

Commit 186592d

Browse files
committed
perf: raise the worker young generation cap to 64MB
At 32MB, workers collected their young generation often enough to cost 6-8% at 4 threads. 64MB keeps most of the memory saved (26-34% at 4 threads) within 1-2.5% of `main`'s build time. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent c41acdf commit 186592d

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎.changeset/keep-memory-down.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
'@doc-kit/generator-react': patch
44
---
55

6-
Builds use less memory, most of all with few threads: each worker's young generation is limited to 32MB, a single thread processes one chunk at a time and lets go of the pages' code before rendering them, and Vite's native bundler gets as many threads as doc-kit and returns the memory it frees. On the Node.js API docs, `--threads 1` now builds with Node.js's `--max-old-space-size=512`.
6+
Builds use less memory, most of all with few threads: each worker's young generation is limited to 64MB, a single thread processes one chunk at a time and lets go of the pages' code before rendering them, and Vite's native bundler gets as many threads as doc-kit and returns the memory it frees. On the Node.js API docs, `--threads 1` now builds with Node.js's `--max-old-space-size=512`.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ export const WORKER_HEAP_SIZE = 512;
2121
* from the machine's memory, as if each worker were the only one, so it made up
2222
* over half of a worker's heap. Node.js's `--max-semi-space-size` replaces it.
2323
*/
24-
export const WORKER_YOUNG_GENERATION_SIZE = 32;
24+
export const WORKER_YOUNG_GENERATION_SIZE = 64;

0 commit comments

Comments
 (0)