Repository navigation
Give compiler workers a larger minor heap - #9188
Conversation
The entry names #9188, so the changelog points at this PR.
Changelog💅 Polish
Semantic Diff1 commit · Full page Give compiler workers a 4M-word minor heap292e8f9 · JonoPrest · Nov 03, 2026, 07:59 UTC
The 2M-word heap was chosen while translating JSX still copied all 591 labels of the DOM props record per element. Each copy forced a minor collection of all domains, and 4M words were no faster than 2M then. 8M words added memory for little more speed. Review
|
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
The entry names #9188, so the changelog points at this PR. Signed-off-by: Jono Prest <jjprest@gmail.com>
5a838f5 to
ed699e0
Compare
Raising the heap to 4M words looks good. The shrink when a worker exits seems unnecessary on the toolchain we now ship: 1. OCaml 5.5 already frees a finished domain's minor heap. That was not true up to 5.4: The "4M heap, no shrink: 913 MB idle" number was probably measured on a 5.3/5.4 switch. Could you re-measure it on 5.5.2? If it idles at master's level, I'd drop the shrink and keep only the constant change. 2. 3. Changelog. If the shrink goes, so does "release it when a worker finishes so watch mode keeps its memory". The explicit PR link isn't needed either: per 4. Nit: comment on Checked and fine: the forced-collection explanation matches the runtime ( |
The entry names #9188, so the changelog points at this PR. Signed-off-by: Jono Prest <jjprest@gmail.com>
ed699e0 to
e03899f
Compare
The entry names #9188, so the changelog points at this PR. Signed-off-by: Jono Prest <jjprest@gmail.com>
|
@codex review |
e03899f to
797a894
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 797a894e05
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Here, too, can you drop the "Link the changelog entry to its pull request" commit? It is not needed. |
797a894 to
c82ab83
Compare
Why:
Every minor collection in OCaml 5 stops all domains until the slowest
one has emptied its heap, so busy compiler workers stall each other.
With the forced collections of JSX translation gone, a larger minor
heap cuts the collections by about 30% and clean build CPU by about
10% on a JSX-heavy project with 7 workers.
The 2M-word heap was chosen while translating JSX still copied all 591
labels of the DOM props record per element. Each copy forced a minor
collection of all domains, and 4M words were no faster than 2M then.
8M words added memory for little more speed.
Review: What does it cost? 16 MB more minor heap per worker while a
build runs, about 200 MB more peak memory on a 552 module app with 7
workers. OCaml 5.5, which the release builds use, decommits a finished
domain's minor heap, so idle watch sessions don't keep the worker heaps.
Signed-off-by: Jono Prest <jjprest@gmail.com>
c82ab83 to
292e8f9
Compare
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-9188 |
Every minor collection in OCaml 5 stops all domains until the slowest one has emptied its heap, so busy compiler workers stall each other. Workers already raised their minor heap to 2M words. This raises it to 4M.
While JSX translation forced collections (fixed in #9187), the heap size made no difference. With those gone, the larger heap cuts minor collections by about 30% on a 552 module React app.
Clean builds on OCaml 5.5.2, 8 vCPU Linux VM, 15 interleaved pairs against the 2M heap, median with 95% CI:
Memory,
rescript watchafter the initial build, median of 3:So builds peak higher (7 x 16 MB more minor heap, plus a larger major heap from fewer collections). OCaml 5.5 decommits a finished domain's minor heap, so the worker heaps aren't kept in watch mode; the remaining idle difference on the React app is major heap. 8M words added memory for little more speed.
Only GC settings change: JS,
.cmi,.cmjand.astare byte identical to master,.cmtreaders give identical output, andmake testandmake test-rewatchpass.