Following a long transcript reconverts the whole file each change #80

Closed
opened 2026-10-02 22:01:29 +00:00 by jhgaylor · 1 comment
Owner

From: #72 (M33).

An opened (not continued) conversation's block checks its transcript every second and, when it changed, converts the whole file again (refresh_import → conversations::convert::entries). geek's transcripts go up to 31 MiB (S20), and a live session changes many times a minute, so following a long session reparses tens of MiB per change. Not measured yet.

  • What: measure first (convert the largest transcript on geek; time and memory per refresh). Then, if it matters, read only what was appended since the last offset, keeping the converter's state (open tool calls, the rewind set) between reads; reconvert in full only when the file shrank or was rewritten.
  • Done when: following a ≥30 MiB live transcript costs about what the appended lines cost, measured and written in PLAN.md.
**From:** #72 (M33). An opened (not continued) conversation's block checks its transcript every second and, when it changed, converts the **whole file** again (`refresh_import` → `conversations::convert::entries`). geek's transcripts go up to 31 MiB (S20), and a live session changes many times a minute, so following a long session reparses tens of MiB per change. Not measured yet. - **What:** measure first (convert the largest transcript on geek; time and memory per refresh). Then, if it matters, read only what was appended since the last offset, keeping the converter's state (open tool calls, the rewind set) between reads; reconvert in full only when the file shrank or was rewritten. - **Done when:** following a ≥30 MiB live transcript costs about what the appended lines cost, measured and written in PLAN.md.
Author
Owner

Done in main (69d4fb4, from 6ba0a1b; numbers in PLAN.md under "#77 and #80: as built"). convert::Follow keeps the converter's state and the offset of the last whole line, and converts only what was appended. It converts again from the start when the file shrinks, is replaced, or its last 4 KiB before the offset differ. Tests check that following gives exactly what a whole conversion gives.

Measured on geek (release build), 30.6 MiB transcript: 31–47 ms and 31 MiB peak to convert the whole file on each change before. After, an appended line costs 0.21 ms median on its own, or 1.3 ms median (2.1 ms max) with #79's branch marking, which walks the chain on each read. No measurable memory either way.

Done in main (69d4fb4, from 6ba0a1b; numbers in PLAN.md under "#77 and #80: as built"). `convert::Follow` keeps the converter's state and the offset of the last whole line, and converts only what was appended. It converts again from the start when the file shrinks, is replaced, or its last 4 KiB before the offset differ. Tests check that following gives exactly what a whole conversion gives. Measured on geek (release build), 30.6 MiB transcript: 31–47 ms and 31 MiB peak to convert the whole file on each change before. After, an appended line costs 0.21 ms median on its own, or 1.3 ms median (2.1 ms max) with #79's branch marking, which walks the chain on each read. No measurable memory either way.
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
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
jhgaylor/illogical#80
No description provided.