Repository navigation
Cut cold-build CPU 5.4x: stop duplicating big internal bodies across split parts; resolve manifest paths from the manifest directory - #558
Merged
Conversation
…rnal bodies so split parts stop duplicating them (symfony-app cold build 5866 s -> 1086 s CPU)
…and resolve the compiler's own directory before build changes cwd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A cold
manticore buildofexamples/symfony-apptook 29:30 wall / 5866 s CPU. Almost all of it wasclang -O2on the split IR parts, and most of that was the same functions compiled again and again.Findings
__mir_dyninl_*(the shared fallback of the__callforwarders) is one 326k-line, 14.6 MB function emitteddefine internal.SplitModulecopies an internal body into every part that calls it, so 48 of 65 parts carried their own copy: ~700 MB of duplicate IR. Compiling p13 alone: 94 s with the copy, 17.8 s without.Changes
dyninlhelper is emittedhiddeninstead ofinternal, so it lives in one part.SplitModule::promoteLarge: an internal body of at least 32 KB with two or more callers is promoted to a single hidden definition. Both split paths (run,runFile) apply it.declareFromDefineended the signature at the last)of the header; a closure header ends withprefix [...]data, so it now stops at the paren matching the first one.manticore build <path>/manticore.jsonresolvessrc,entry,outputand the Composer root against the manifest's directory, not the caller's cwd.bin/buildwrites its temp manifest besidemanticore.json, andtests/aot/runner/manticore.jsonis rewritten relative to its own directory.Measured (symfony-app, cold object cache, loaded machine)
Verification
bash tests/aot/run.sh -j 0: 2569 passed, 0 failed (2571 total, -O2, macOS arm64)./(200) and/nope(404). On this branch alone the binary starts but hits the knownvendor/autoload.phprequire error, which Hard bugs: reference representation, object handles, reified fit, comptime require #555 fixes.Not run
Linux gate, difftest, fixpoint,
tools/ext_smoke.sh(its manifests still use repo-root paths).