Skip to content

Give the frontend a larger nursery - #120

Merged
Leitwolf11 merged 3 commits into
mainfrom
perf/frontend-gc
Oct 31, 2026
Merged

Leitwolf11 merged 3 commits into
mainfrom
perf/frontend-gc

Conversation

@Leitwolf11

@Leitwolf11 Leitwolf11 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Starts the frontend RTS with -A64m -n4m instead of the default 4 MiB nursery.

The frontend grows linearly with the program, so there was no quadratic path to fix, and GC was about a third of its time. The AST stays live, so the small nursery kept collecting and copying it.

Six alternating runs on a generated program of 13 sources and about 4800 methods, optimized talac, --emit=core, on a noisy machine:

Options Min Median GC median Total memory
default 4.98 s 7.58 s 3.05 s 346 MiB
-A64m -n4m 4.13 s 4.61 s 1.60 s 331 MiB

-A64m without -n4m showed no clear gain in single runs, and -O512m added nothing. tala-compiler tests pass on Windows, and the generated program builds and runs. tali shares this library, so it gets the same nursery.

Self-review: rts_opts is the same channel as -with-rtsopts, so it needs no rts_opts_enabled change and users still cannot pass RTS flags. Rts.h replaces HsFFI.h, which it includes, and is needed because RtsAPI.h does not stand alone. It prints deprecated-volatile warnings from GHC's own headers in C++20, which do not fail the build. Linux and macOS are left to CI.

Leitwolf11 added 3 commits October 31, 2026 17:34
Measured on 4800 methods, alternating runs: GC went from 3.05 s to 1.60 s
at the median, the whole frontend from 7.58 s to 4.61 s, and total memory
stayed at about 340 MiB, since 4 MiB chunks keep a large nursery from
raising what the process touches.
RtsAPI.h does not stand alone: it needs the types Rts.h defines.
Publishing the bundle failed on two CI runs with Access is denied: the
smoke tests have just run its programs, and Windows keeps their files busy
for a moment. The rename now tries again for up to ten seconds, on that
error alone.
@Leitwolf11

Copy link
Copy Markdown
Contributor Author

Self-review of the later commit: renameWhenReleased retries only on fs.ErrPermission, for at most ten seconds, so any other failure still surfaces at once. The Windows job passed on this head, which had failed twice on that rename before.

@Leitwolf11
Leitwolf11 merged commit 2da5036 into main Oct 31, 2026
43 checks passed
@Leitwolf11 Leitwolf11 mentioned this pull request Oct 31, 2026
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.

1 participant