Skip to content

Stream editor, LSP, and terminal data flow for large files - #756

Open
SnaetWarre wants to merge 4 commits into
athasdev:mainfrom
SnaetWarre:perf-data-flow
Open

SnaetWarre wants to merge 4 commits into
athasdev:mainfrom
SnaetWarre:perf-data-flow

Conversation

@SnaetWarre

@SnaetWarre SnaetWarre commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Typing and scrolling in large files re-parsed whole documents on
every keystroke: full-content LSP sync, one store commit per preloaded
directory, one xterm write per output chunk, and syntax highlighting on
the UI thread.

This routes Monaco edits through incremental document batches shared by
LSP sync, undo history, and the view layer, batches explorer preload
commits and terminal writes, and moves highlighting off the UI thread.

Numbers, measured on the same machine at base and head:

area base head
explorer preload store commits (small / mid / large fixture) 9 / 33 / 65 2 / 5 / 9
terminal writes for 1,000 ordered 32-byte chunks 1,000 1
terminal store notifications for 1,000 no-op updates 1,000 0
editor metadata median per keystroke, 20 MiB doc 35.6 ms 3.3 ms
editor metadata median per keystroke, 5 MiB doc 10.9 ms 0.09 ms
editor metadata median per keystroke, 1 MiB doc 1.22 ms 0.002 ms
highlight main-thread delay median 547.5 ms 4.2 ms dispatch

Bytes and order are preserved on every path above. Timing fixtures
are synthetic Bun runs, not WebKitGTK rendering figures.

  • How to test:
  1. bunx tsc --noEmit (clean)
  2. bunx vp test run src/features/editor/tests/ src/features/file-system/tests/ src/features/terminal/tests/ src/features/git/tests/ src/features/file-explorer/tests/ (185 files, 844 tests pass)
  3. bun check:rust (clean) and cargo test -p athas-lsp (18 pass)

Screenshots:

Not applicable (no visual change).

Every incremental path falls back to a full recompute on unexpected
batches, covered by new regression tests. The branch bases on
063f5ab8 and merges cleanly into main.

Route Monaco edits through document change batches so LSP sync, undo
history, and the view layer share one incremental path instead of full
re-parses on every keystroke. Track the sync state in a new Rust
document session that maps Monaco offsets onto LSP versions and reuses
pending notifications. Make the file tree filter, watcher preload
queue, and terminal output buffer incremental so scrolling and typing
stay responsive with large repos. Keep the view snapshot guard cheap
with a revision plus content reference check. Cover the new paths with
regression tests and baseline evidence.
@SnaetWarre

Copy link
Copy Markdown
Contributor Author

let me remove all of that markdown for ya real quick

mehmetozguldev and others added 3 commits September 21, 2026 16:05
Apply vp formatting to the six flagged frontend files so
vp check passes again. The changes are whitespace and
line-wrap only with no behavior change.
Combine the main markdown highlight scheduling with the
perf-data-flow worker tokenizer. Code blocks are still
highlighted through the worker with hashed cache keys and
per-block request keys, but now sequentially with yields
to the main thread and efficient string building. Update
the highlight test to mock the worker client.
@SnaetWarre

Copy link
Copy Markdown
Contributor Author

@mehmetozguldev can you run CI please?

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.

2 participants