Skip to content

Faster builds: auto-split from 32 MB, compiler without the cycle collector, cheaper type inference - #386

Merged
blacktrs merged 6 commits into
mainfrom
perf/auto-split-threshold
Oct 24, 2026
Merged

blacktrs merged 6 commits into
mainfrom
perf/auto-split-threshold

Conversation

@blacktrs

@blacktrs blacktrs commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Why

Profiling manticore-fmt (60 MB IR) and symfony-app (876 MB IR) showed ~80% of fmt build time in a single serial clang -O2, and a frontend dominated by repeated full type-inference runs (InferTypes ~43% of frontend; each run costs 0.9-2.7 s even when it changes few functions).

What

  • AUTO_SPLIT_MIN_BYTES 128 MB -> 32 MB: application modules above 32 MB are split into parts automatically (available_externally copies keep cross-part inlining). bin/build exports MANTICORE_AUTO_SPLIT=0, so the compiler itself stays one translation unit and its output is unchanged.
  • bin/build exports MANTICORE_AUTO_GC=0: the compiler is baked without the automatic cycle collector.
  • InferTypes per-run cost, output-preserving: skip the closure-captured-locals walk for bodies without closures; fuse the empty-literal nesting walk into walkLocalFacts; order inferNode kind dispatch by frequency.

Measured

  • manticore-fmt, both applications: 175 s -> 87 s (clang step 58 s -> 16.6 s). Runtime of the split fmt binary: 14.0 s vs 14.3 s user over 15 runs; binary +3.5%. Output identical (237 of 310 files).
  • Compiler without the collector: user time 46/44 s vs 49/51 s on the fmt build; peak RSS 975 MB vs 978 MB.
  • Inference changes: fmt frontend about 8-11% faster; staged IR byte-identical (cmp) for both fmt apps after each commit.

Investigated, not shipped

Skipping closing full InferTypes rounds changes IR (not redundant); scoped re-inference is neither equivalent nor faster; no sound class-level gate for reflection trampolines on Symfony-class programs.

Not run

Full AOT suite, difftest, Linux gate, peak RSS on symfony-app with the collector off. Targeted: -k narrow 11/11, -k mono 5/5, -k closure 94/94; bin/build green.

@blacktrs blacktrs changed the title Faster application builds: auto-split from 32 MB, compiler built without the cycle collector Faster builds: auto-split from 32 MB, compiler without the cycle collector, cheaper type inference Oct 23, 2026
@blacktrs
blacktrs merged commit 35e4cac into main Oct 24, 2026
12 of 13 checks passed
@blacktrs
blacktrs deleted the perf/auto-split-threshold branch October 24, 2026 06:26
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