Skip to content

Keep the context's counts until a row is written - #257

Merged
abrignoni merged 1 commit into
mainfrom
perf/context-folder-status
Oct 1, 2026
Merged

abrignoni merged 1 commit into
mainfrom
perf/context-folder-status

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

Keeps the context's counts until a row is written to the case.

  • CaseDB.derived holds an answer worked out from the rows until the connection's total_changes moves.
  • The context's counts and the folder source facts use it. The folder itself is still checked on disk every time.
  • On a 150,000 row case a repeated /api/context went from about 600 ms to about 1 ms, and after a write to about 480 ms.
  • New tests check that a repeat reads no rows and that no write is followed by an old answer.

Co-Authored-By: Claude Opus 5.5 [email protected]

On a case of 150,000 rows in one folder source, one /api/context took 589
to 627 ms: folder_status read every row of the source (298 ms) and seven
counts over files took 18 to 82 ms each. The gallery asks for the context
on load, after imports and every fifteenth tick of a running job, and
reads on the shared connection waited behind it (p95 101 ms).

CaseDB.derived keeps an answer worked out from the case's rows until the
connection's total_changes moves, the number the list view's count cache
already uses. The context's counts and the folder facts are kept that
way. The folder and the sample of files are still looked for on disk on
every call. folder_status also reads only the paths.

A context with nothing written since the last now takes 1.0 to 1.5 ms and
reads no row of files; after a write it takes 464 to 489 ms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@abrignoni
abrignoni merged commit d36da6f into main Oct 1, 2026
8 checks passed
@abrignoni
abrignoni deleted the perf/context-folder-status branch October 1, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant