Repository navigation
Commit 01a2bbd
authored
perf(compile): reuse rule results on warm and one-edit compiles (#915)
* perf(compile): reuse custom-rule results whose recorded fact reads are unchanged
The isolated custom-rule host now records which compiler facts each rule
invocation reads through its context. Results are cached per rule and subject
and reused only while every recorded fact digest, the rule implementation and
import closure, the rules configuration, the installed code identity, and the
dialect are unchanged. Rules whose reachable module state changes between
invocations, or that touch private view state, are treated as reading every
fact.
Custom rules no longer serialise the whole compiled project for a cache key:
the project is pickled only when a host run is needed, and built-in rules key
their project-level identity on request facts instead of walking project files.
Refs CHI-443, CHI-444
* perf(compile): reuse the built-in rules response for an identical native request
Warm compiles re-sent an unchanged 60 MB request to the native engine,
which spent about a second re-validating per-model cache entries. The
complete response is now memoized under a digest of the serialized request
and the installed code identity, so any fact, scope, config or code change
re-evaluates through the native per-model cache.
Refs CHI-445
* perf(compile): resolve macro context injection once per loaded macro
Every macro call rebuilt the callable's inspect signature to decide whether
to inject the macro context. The decision is now a cached property of the
loaded macro, removing about 3,600 signature constructions from a dense
3,000-model compile.
Refs CHI-442
* perf(compile): guard dense warm and one-edit compile budgets and oracles
Adds 3,000- and 5,000-model dense guards that compile cold, warm, and after
a single model edit, then compare the edit with a from-scratch uncached
oracle. They assert exact fingerprints, complete warm cache reuse, and that
the edit re-evaluates only the edited model's built-in rules while the
project-wide custom rule is reused. The dense job timeout grows to cover the
extra compiles.
Refs CHI-441
* fix(rules): verify filesystem reads and conservatively key untracked custom-rule results
- Record the digest of each project-tree value a rule actually read in the
host and refuse to store a result whose filesystem facts changed before
the parent recorded the fingerprint.
- Key untracked rules on their recorded reads plus every observable fact,
so files outside the discovered tree (hidden directories) still
invalidate them.
- Never cache rules that touch private or unknown fact-view attributes.
- Include the thread id in the custom-rule cache temporary file name.1 parent afc2106 commit 01a2bbd
46 files changed
Lines changed: 3013 additions & 1056 deletions
File tree
- .github/workflows
- crates/sqlbuild-rules-native/src
- bindings/_helpers
- engine
- _helpers
- main
- tests
- src/sqlbuild
- compiler
- compile
- _helpers/render
- fact_cache/main
- rule_engine
- _helpers
- engine
- host
- run
- classes
- tests
- e2e/src/sqlbuild/cli/commands/main
- compile
- rules
- integration/src/sqlbuild/cli/commands/main
- unit/src/sqlbuild/rule_engine/_helpers/engine
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 | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | | - | |
| 368 | + | |
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
76 | 82 | | |
77 | 83 | | |
78 | 84 | | |
| |||
422 | 428 | | |
423 | 429 | | |
424 | 430 | | |
| 431 | + | |
425 | 432 | | |
426 | 433 | | |
427 | 434 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | 35 | | |
42 | 36 | | |
43 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | 2 | | |
5 | 3 | | |
6 | 4 | | |
| |||
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | 29 | | |
62 | 30 | | |
63 | 31 | | |
| |||
76 | 44 | | |
77 | 45 | | |
78 | 46 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | 47 | | |
93 | 48 | | |
94 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments