Repository navigation
perf(compile): lower rules-phase peak memory - #937
Merged
Merged
Conversation
Share SQL file text that discovery already holds instead of keeping a second copy for SQL lint and SQL Rules, and return freed glibc heap pages to the OS before the rules phase starts, where native rules, SQL lint and the custom-rule host overlap. Text is only shared when it is byte-for-byte identical to the fresh read, so findings and diagnostics are unchanged. Dense 10,000-model --no-cache main-process peak drops about 15%, so the dense guard tightens from 3.5 GiB to 3.25 GiB.
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
Since native analysis runs in parallel at 10k models (#934), the compile's memory peaks in the rules phase. Profiling showed lint keeping a second copy of every SQL file's text and ~280 MB of freed-but-held allocator memory before rules start (CHI-441).
Changes
malloc_trim) at the start of rules evaluation; a no-op on other platforms.Verification
--no-cache, 4 GiB cgroup (base → head medians): main peak 2822 → 2404 MB, process group 2965 → 2586 MB; 3k −9 to −11%. CPU unchanged; fingerprints and diagnostics identical.run_lintintegration tests for text reuse.make test,make check-ci.