Skip to content

Make the per-message undo checkpoint incremental (fixes ~1s Enter lag) - #7

Merged
Darknode-Official merged 1 commit into
mainfrom
fix/submit-paint
Nov 1, 2026
Merged

Darknode-Official merged 1 commit into
mainfrom
fix/submit-paint

Conversation

@Darknode-Official

Copy link
Copy Markdown
Owner

Every message runs nexusCheckpoint() synchronously before it is sent. It
built the snapshot with git add -A into a temp index that was deleted
each time, so git had no stat cache and rehashed the entire working tree
on every Enter - including .nexus/session.json, which can grow to tens
of MB, before removing .nexus from the snapshot again. On a large repo
with a long session that was ~1.3s per message.

  • keep the temp index between turns, seeded once from the repo's own
    index, so only changed files are rehashed;
  • exclude .nexus in the add pathspec so the session file is never hashed.

Snapshots are byte-identical to before (verified, including after an
edit, a new file and a deletion). Measured with a real 90 MB session:
Enter to sent went from ~1350 ms to ~67 ms; checkpoint alone on a
darknode-web clone from 290-1440 ms to ~16 ms.

Every message runs nexusCheckpoint() synchronously before it is sent. It
built the snapshot with `git add -A` into a temp index that was deleted
each time, so git had no stat cache and rehashed the entire working tree
on every Enter - including .nexus/session.json, which can grow to tens
of MB, before removing .nexus from the snapshot again. On a large repo
with a long session that was ~1.3s per message.

- keep the temp index between turns, seeded once from the repo's own
  index, so only changed files are rehashed;
- exclude .nexus in the add pathspec so the session file is never hashed.

Snapshots are byte-identical to before (verified, including after an
edit, a new file and a deletion). Measured with a real 90 MB session:
Enter to sent went from ~1350 ms to ~67 ms; checkpoint alone on a
darknode-web clone from 290-1440 ms to ~16 ms.
@Darknode-Official
Darknode-Official merged commit be6c7eb into main Nov 1, 2026
0 of 3 checks passed
@Darknode-Official
Darknode-Official deleted the fix/submit-paint branch November 1, 2026 00: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