Views call graph: compact store (diet part 1)
Part 1 of the call-graph store diet: the views call-graph database for AFT's own repository goes from 1,966 MB to 1,049 MB (−47%) and builds about 10–15% faster, with every recorded answer byte-identical. Per the release ruling, this ships with the views-default release, so users rebuild their call graph once.
What changes in the views store
- Per-file JSON payloads (
view_bindings,view_file_surfaces,view_dispatch_files) are stored zlib-compressed at the fastest level; the digests are still those of the JSON text. About 300 MB of repetitive JSON becomes about 37 MB. view_unknown_livekeeps one row per caller file and protected target instead of one per call site: its only reader asks which targets are alive. 1.46 M rows / 345 MB become 253 K rows / 30 MB. Main's empty-table streaming path is kept.- The two site tables are
WITHOUT ROWID, so they don't store a second copy of their key. - Node ids keep 64 bits of their digest (views spell them
vp/vtplus 16 hex digits); a short prefix sorts like the full digest, and store triggers refuse two different symbols that share an id instead of letting one replace the other. - Two indexes no statement uses are dropped (edges by target node, dispatch hints by method name).
BUILD_OUTPUT_VERSIONv24 on top of main's v23.
Measured (interleaved in one job, 7,331 files, same probe on both sides):
| main | this PR | |
|---|---|---|
| views base | 1,966 MB | 1,049 MB |
| materialize | 71.0 / 89.9 / 64.8 s | 64.0 / 76.4 / 55.9 s |
| CPU (user) | 116 / 130 / 113 s | 110 / 122 / 100 s |
| peak RSS | 2.06 GB | 1.97 GB |
Verified with the store-diet harness (#1344)
- Every reply golden replays byte for byte: the six operations for the legacy and views stores and both wire captures.
inventory.py compare-planspasses against main's baseline plans: the compacted tables are searched through their primary key; the unknown-live delete still uses its whole key; new scans are test-only probes. Store-internal snapshots (node id form, tie-order ids, one Kotlin fixture's liveness count, plans) were reviewed and re-accepted; each change is listed in the commit messages.- The SQL census maps each rewritten statement to its baseline id (1,729 statements;
inventory.py checkpasses). - 1,819 library tests (call graph, views, zoom, inspect, harness), 111 call-graph and views integration tests, formatting and the Windows check.
One proof test from main counted unknown-receiver rows per call site; it now asserts the per-file count (2 before and after removing one of two identical sites), with its parity checks against the row-by-row writer and a cold rebuild unchanged.
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Shrinks the views call-graph store by about 47% (1,966 MB to 1,049 MB for AFT's own repository) and builds about 10–15% faster, with every recorded answer byte-identical. Ships with the views-default release, so users rebuild their call graph once.
What changes in the store
- Per-file JSON payloads are stored zlib-compressed at the fastest level; digests stay those of the JSON text. About 300 MB of repetitive JSON becomes about 37 MB.
view_unknown_livekeeps one row per caller file and protected target instead of one per call site, cutting 1.46 M rows / 345 MB to 253 K rows / 30 MB.- Both site tables are
WITHOUT ROWID, and node ids hold 64 digest bits (16 hex digits) instead of 256, with triggers refusing two different symbols that share an id. - Two unused indexes are dropped, and
BUILD_OUTPUT_VERSIONbumps to v24.
Verified
- The store-diet harness replays every reply golden byte for byte; plans and store-internal snapshots were re-accepted.
- 1,819 library tests and 111 call-graph and views integration tests pass.