Repository navigation
Commit d6be114
authored
perf(plan): cut plan and build planning time on large projects (#875)
* perf(plan): compute migration fingerprints once and only where needed
Rename discovery fingerprinted every unbuilt model under each rename
map even when no earlier model could match, and the plan fingerprinted
every entry again for storage. Skip matching without candidates, reuse
fingerprints across rename maps and phases, attach stored fingerprints
only to entries that will be built, and skip them for sqb plan, which
never stores them.
* perf(plan): remove quadratic union, ordering, and logging work
Resolving column reads through a UNION chain materialised every
branch's full argument tree at each level, so fixture validation grew
cubically with fixture rows. Read only the needed arguments. Order keys
with a heap instead of re-sorting the ready list, and look up the
package version once instead of per logged statement.
* perf(plan): skip rebinding sources whose inspection adds no evidence
Expression sources report column names without types, so every source
looked changed and every downstream model was analysed again during
planning. Treat inspected columns as changed only when names differ or a
reported type differs from the compile-time shape.
* perf(build): reuse migration fingerprints from the local compile cache
Every build fingerprinted every model it built, about 7 ms on average
and linear in query size, so a warm build of an unchanged 3,000-model
project spent 25 s recomputing identical values. Persist fingerprints in
the project-local compile cache, keyed by query, metadata, dialect,
visible renames, algorithm, and sqlbuild and polyglot versions, with
digest-checked entries that fall back to recomputing when damaged.
Also stop walking each query's local names twice.
* perf(plan): discover projects for plan and build like compile
Plan and build located every model's output columns during discovery,
which took about 2.4 s on the 3,000-model benchmark, while compile skips
it. The only consumer, contract diagnostics, already computes those
locations lazily when they are missing. Skip the eager scan for plan and
build as compile does.
* perf(plan): infer each distinct SQL test fixture once per plan
Fixture validation re-inferred the columns of every fixture body for
every test, although identical bodies under the same inference profile
always infer the same columns. Memoise inference per planning context,
keyed by fixture SQL and an equal profile, and bypass the memo for
profiles that carry a binding catalog.
* test(perf): guard plan and build time, memory, and scaling
Bound sqb plan --json on the 3,000-model inspection benchmark relative
to a warm compile measured in the same test, cap its peak RSS, and fail
when planning CPU grows super-linearly from a 300-model copy. Build a
1,000-model DuckDB benchmark from an empty warehouse with wall and RSS
limits, then plan against its stored state after editing models and
after renaming one. Raise the lineage ceilings to 3.0 s for CI headroom.
Refs: CHI-432
* fix(plan): treat non-ASCII fingerprint cache digests as cache misses
* test: count the migration fingerprint cache among compiler caches1 parent 6da7c51 commit d6be114
46 files changed
Lines changed: 1781 additions & 78 deletions
File tree
- .github/workflows
- src/sqlbuild
- cli/commands/_helpers
- build_planning
- plan
- compiler
- compile/_helpers
- analysis
- assembly
- pipeline
- main
- planner
- _helpers
- fixtures
- graph
- migrations
- planning
- sql_tests
- classes
- main/execution
- runtime
- compute_logs/classes
- observability/_helpers
- tests
- e2e/src/sqlbuild/cli/commands/main
- build
- compile
- integration/src/sqlbuild/cli/commands/main
- model_migrations
- unit/src/sqlbuild/compiler
- compile/_helpers
- planner
- _helpers
- classes
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
| 87 | + | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
240 | 241 | | |
241 | 242 | | |
242 | 243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
| 220 | + | |
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
| 231 | + | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
205 | 215 | | |
206 | 216 | | |
207 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| 250 | + | |
250 | 251 | | |
251 | 252 | | |
252 | 253 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
217 | 218 | | |
218 | 219 | | |
219 | 220 | | |
| 221 | + | |
220 | 222 | | |
221 | 223 | | |
222 | 224 | | |
| |||
250 | 252 | | |
251 | 253 | | |
252 | 254 | | |
253 | | - | |
| 255 | + | |
254 | 256 | | |
255 | 257 | | |
256 | 258 | | |
| |||
0 commit comments