Repository navigation
perf(compile): reuse discovery, analysis and writes after model-only edits - #971
Merged
Merged
Conversation
After an edit that touches only existing model files, reuse the non-model declaration files the stored compile parsed (sources, tests, schemas, macros, functions, seeds, scoped declarations) and discover only the model files again. Any other change discovers everything and records the declarations with the stored renders.
After a model-only edit, a model whose render was reused, whose recomputed analysis cache key equals the stored one and is used by no other model, and whose shared analysis inputs are unchanged may take its analysis from the stored compile instead of reading the analysis cache. The served analysis is kept only once its parents are final in this compile and each parent's final output signature equals the signature recorded with it; otherwise the model is analyzed again and its dependents are invalidated as usual. Previous signatures still come from the analysis cache, as without reuse, and an analysis is recorded for the next compile only when its recorded parent signatures match this compile's final ones, so another command advancing the analysis cache between compiles cannot leave a stale analysis served. Published shapes are computed only for models without a declared shape.
Store each compiled artifact's digest beside its stat stamp in the compile reuse entry. When a later full compile writes an artifact whose stat identity still matches the stored stamp and whose new contents have the stored digest, it neither reads nor rewrites the file. Any stat or digest difference falls back to comparing the file's bytes.
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
After a one-model edit, compile still rediscovered every declaration file, re-read every model's analysis from the cache and re-compared every compiled artifact, even when render reuse (#955) had already shown only one model changed (CHI-508).
Changes
analysis_reuse_hitscounts analyses actually served.Verification
--no-cache, including two-hopSELECT *chains withplan,build, another target or a no-reuse compile between edits, same-SQL twin models, and random chains; each new reuse fails the oracle when deliberately broken.make test,make check-ci.