Repository navigation
perf: a new transcript no longer re-tags every file discovered after it (#99) - #123
Conversation
…it (ClaudeCodeUsage#99) Discovery order only breaks ties between files with the same first timestamp, but it is stored as the manifest position. A transcript appearing (a new session, and every sub-agent run) shifts the position of every file after it, and each shifted file went through `retagFileOrdering`: all of its records were removed and re-added, re-bucketing every aggregate they touch. Measured on a live history (1,043 files, a new file at position 312): one new transcript cost 20.7 s of CPU and 116,131 aggregate mutations for a single body read. The extension log of one working day showed ~25 such refreshes at 15-40 s each — after ClaudeCodeUsage#119-ClaudeCodeUsage#121 the largest remaining cost of a refresh. Files the index already holds now keep their stored rank as long as their relative order is unchanged, and a new file takes a rank between its neighbours. The order is the manifest's, so every tie-break still agrees with the full loader. If known files change their relative order, or the gap between two neighbours runs out, the manifest positions are used as before. Ranks are only compared, never used as positions. Same measurement with the change: 2.2 s of CPU and 19 aggregate mutations. Test: `a new transcript does not re-tag the files discovered after it` inserts a file in the middle of twelve, tying with its right neighbour on first timestamp and message so that only discovery order picks the counted copy. It fails on the parent commit (33 mutations for 1 body read), asserts that the full loader counts the new file's copy, and that records and content analysis equal the full loader's — also after two known files swap order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🤖 Automated first-pass review TL;DR The performance rationale is credible and the CHANGELOG entry is present and specific. The main merge-readiness risk is that Analysis
Suggested next step(s)
This is an automated first pass; the maintainer makes the final decision. 🤖 Generated by DeepSeek as an automated first pass — not a maintainer decision. |
|
Merged for the upcoming v2.4.1 performance patch. Thank you @rsyuzyov for We verified the original change against the latest 2.4.1 hotfix: 1,272 Node tests New main CI is running; the release is still a draft. This fixes the specific retagging 🤖 Generated with OpenAI Codex |
Discovery order only breaks ties between files with the same first timestamp,
but it is stored as the manifest position. A transcript appearing (a new
session, and every sub-agent run) shifts the position of every file after it,
and each shifted file went through
retagFileOrdering: all of its records wereremoved and re-added, re-bucketing every aggregate they touch.
Measured on a live history (1,043 files, a new file at position 312): one new
transcript cost 20.7 s of CPU and 116,131 aggregate mutations for a single
body read. The extension log of one working day showed ~25 such refreshes at
15-40 s each — after #119-#121 the largest remaining cost of a refresh.
Files the index already holds now keep their stored rank as long as their
relative order is unchanged, and a new file takes a rank between its
neighbours. The order is the manifest's, so every tie-break still agrees with
the full loader. If known files change their relative order, or the gap
between two neighbours runs out, the manifest positions are used as before.
Ranks are only compared, never used as positions.
Same measurement with the change: 2.2 s of CPU and 19 aggregate mutations.
Test:
a new transcript does not re-tag the files discovered after itinsertsa file in the middle of twelve, tying with its right neighbour on first
timestamp and message so that only discovery order picks the counted copy. It
fails on the parent commit (33 mutations for 1 body read), asserts that the
full loader counts the new file's copy, and that records and content analysis
equal the full loader's — also after two known files swap order.
Follow-up to #119–#121 for #99. Thanks for the review there — this one keeps
exact semantics: ranks change nothing about which copy wins, only how often the
index has to recompute it.
What remains of a new-file refresh after this is
recomputeDerivedRows(session/workflow/branch breakdowns) and
buildAnalysisRuntimeState; separately,a deleted transcript still forces a full rebuild (3 times in the same day,
75-110 s each). I'd look at those next unless you'd rather take them.
Local note: on Windows
a 645-session corpus…anddefault content analysis does not revisit historical…fail onmainas well; a few timing-sensitive testsflake under load and pass on their own.
🤖 Generated with Claude Code