[WIP] Reduce task index storage and cold growth #721

Closed
kayg wants to merge 5 commits from perf/cold-growth-fix into perf/cold-growth-gate
Owner

At 100k, task metadata adds roughly 15–17% to cold indexing on the settled filesystem measurement. This change brings all three runs below the unchanged 10% limit and reduces live SQLite pages by 41.34 MiB.

Checkbox rows keep source keys and line locations; the selected display page reads its words through Notes. Task rows use stable integer cache keys, compact sort fields and normalized day keys, retaining raw date strings when needed. Untracked counts share the source table. Covering task indexes and the narrow public-ID membership index retain fast list queries.

Notes exposes generic cache keys and a lazy Markdown context to describers, so backlinks and task formats share structural parsing. Task field edits update existing rows and tag sort fields in place. The cache migration rebuilds derived rows from source files; format parsing and display extraction stay in the task format module.

Run Before cold growth After cold growth Before warm p95, ms After warm p95, ms
1 15.094% 8.269% 37.219 24.811
2 16.798% 7.844% 32.024 35.887
3 15.385% 7.836% 45.881 24.629

Candidate task gates pass x3 at both 10k and 100k. Server gates pass x3 at 100k, with five warm runs per report. Workspace tests: 1195 passed, 0 failed, 20 existing ignored tests; real-server and task SIGKILL/recovery cases pass. Formatting, clippy with warnings denied, both typechecks and the 5000-case property run pass. Web typecheck reports 14 warnings and zero errors.

Across the three 100k runs, median Untracked p95 falls from 3.506 to 0.563 ms. Other task view medians improve except child-tag grouping, which varies by +0.50% (5.914 to 5.944 ms). Warm tails vary across pairs; every measurement, including baseline and earlier candidate failures, is retained.

Server timings also vary across pairs. Median p95 across the three full reports:

Metric Before After
home.first_page (ms) 11.051 11.759
home.page (ms) 3.810 3.648
home.page_title (ms) 2.089 2.249
home.page_tag (ms) 30.934 34.891
search.query (ms) 4.579 4.273
sync.round_trip (ms) 0.972 1.005
sync.save_ack (ms) 13.789 14.427
idle.rss (MB) 56.566 63.516

All values, including increases, are retained in the evidence.

Addresses #686. Depends on #717; the PR targets perf/cold-growth-gate. Full evidence includes table/index sizes, row and column attribution, all 184 query plans, query timings, raw measurements and verbatim gate output.

At 100k, task metadata adds roughly 15–17% to cold indexing on the settled filesystem measurement. This change brings all three runs below the unchanged 10% limit and reduces live SQLite pages by 41.34 MiB. Checkbox rows keep source keys and line locations; the selected display page reads its words through Notes. Task rows use stable integer cache keys, compact sort fields and normalized day keys, retaining raw date strings when needed. Untracked counts share the source table. Covering task indexes and the narrow public-ID membership index retain fast list queries. Notes exposes generic cache keys and a lazy Markdown context to describers, so backlinks and task formats share structural parsing. Task field edits update existing rows and tag sort fields in place. The cache migration rebuilds derived rows from source files; format parsing and display extraction stay in the task format module. |Run|Before cold growth|After cold growth|Before warm p95, ms|After warm p95, ms| |---|---:|---:|---:|---:| |1|15.094%|8.269%|37.219|24.811| |2|16.798%|7.844%|32.024|35.887| |3|15.385%|7.836%|45.881|24.629| Candidate task gates pass x3 at both 10k and 100k. Server gates pass x3 at 100k, with five warm runs per report. Workspace tests: 1195 passed, 0 failed, 20 existing ignored tests; real-server and task SIGKILL/recovery cases pass. Formatting, clippy with warnings denied, both typechecks and the 5000-case property run pass. Web typecheck reports 14 warnings and zero errors. Across the three 100k runs, median Untracked p95 falls from 3.506 to 0.563 ms. Other task view medians improve except child-tag grouping, which varies by +0.50% (5.914 to 5.944 ms). Warm tails vary across pairs; every measurement, including baseline and earlier candidate failures, is retained. Server timings also vary across pairs. Median p95 across the three full reports: |Metric|Before|After| |---|---:|---:| |home.first_page (ms)|11.051|11.759| |home.page (ms)|3.810|3.648| |home.page_title (ms)|2.089|2.249| |home.page_tag (ms)|30.934|34.891| |search.query (ms)|4.579|4.273| |sync.round_trip (ms)|0.972|1.005| |sync.save_ack (ms)|13.789|14.427| |idle.rss (MB)|56.566|63.516| All values, including increases, are retained in the evidence. Addresses #686. Depends on #717; the PR targets `perf/cold-growth-gate`. [Full evidence](https://git.kayg.org/attachments/a7976354-ddff-4d53-9c2f-b4e4eff7fef4) includes table/index sizes, row and column attribution, all 184 query plans, query timings, raw measurements and verbatim gate output.
Author
Owner

Superseded by #727 (same fix plus tag-list and idle-memory recovery). Closing.

Superseded by #727 (same fix plus tag-list and idle-memory recovery). Closing.
kayg closed this pull request 2026-10-28 10:04:27 +00:00
Some checks failed
CI / server (pull_request) Successful in 1m18s
CI / rust (pull_request) Successful in 13m55s
CI / web (pull_request) Failing after 40s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!721
No description provided.