Repository navigation
perf(analysis): check SQL-macro arguments on the analysis pool and drop duplicate work - #1506
Merged
Merged
Conversation
…op duplicate work The probes that check each typed SQL-macro call ran one model at a time on the session thread while the analysis pool sat idle; each is a parse and a lineage analysis, so in projects with many typed calls they were about half of all analysis time. Each model's probes now run on the pool, and a probe's relation lookup reads a map built once per schema instead of lower-casing, formatting and scanning every relation. Duplicate work inside the per-model analysis is gone too: - lineage and name findings come from one SQLQuack analysis instead of two; - the share key feeds the hasher its fields instead of a Debug string of every upstream column; - normalisation counts characters forward from the last edit instead of from the start of the SQL for every match, which was quadratic in long models; - column nullability is read from a map instead of a scan per column. Results are unchanged: findings, compile JSON and compiled files are byte-identical before and after.
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
Typed SQL-macro argument probes ran one model at a time on the session thread while the analysis pool sat idle: about half of analysis time in projects with many typed calls. Per-model analysis also repeated work: two SQLQuack analyses per model, a share key hashed from Debug text of every upstream column, and normalisation recounting characters from the start of the SQL per match.
Changes
statement_lineage_and_findingscall.Hashinstead ofDebugtext.share_key,Arcshapes, probe-name caching, pool size, probes skipping diagnostics.Verification
Same orb, base
mainand this branch alternating, 3 runs each, load 1–3:model_analysis_msCompile JSON (minus timings) and every compiled file are byte-identical; shared/unshared analysis counts are unchanged (2,425 / 575, dense).
cargo test -p sqlbuild-analysis, the SQL-macro E2E suite (301 passed),make check-cipasses; locallymake testfails only the testsmainfails here too (Docker, launcher version).