Return dirty-page preview patches

Project previews accept ?patch=1 and only include pages listed in changedPages.
Cache hits return an empty patch list. The web client applies sparse patches by
page index instead of rebuilding every page.

Add a two-page server test that edits only the second page and checks that the
patched payload contains exactly the changed page indices. Measure the arXiv
heading edit: 2 of 3 pages still changed (315 KB vs 396 KB full, 2.66 s), so
dirty-page transfer is in place but incremental layout latency is not.

Test count is 1073 (67 server).
This commit is contained in:
gloamxun committed 2026-10-27 21:18:39 +08:00
1 parent 86e95881e7
commit 9231c3a7d6
8 files changed
+90 -17

No files matched your search

+6 -3
View File
@@ -55,13 +55,16 @@ execution is not a goal.
- project previews accept `?buffer=1` with the editor text as the request
body, so preview no longer waits for the 450 ms disk save;
- the web editor previews on a 40 ms debounce while saving on the old timer;
- the preview response can be filtered to `changedPages` with `?patch=1`;
- the web client applies sparse page patches by their `index`;
- `changedPages` already identifies the pages that need repainting.
- Incremental bottlenecks:
- the server still returns every page's SVG JSON;
- the browser downloads all pages before hash-skipping;
- measured warm buffer previews are still about 430 ms for article-basic
and 2.1 s for the arXiv template; the <100 ms target is not met;
- no WebSocket/SSE stream or dirty-page patch protocol.
- a heading edit reflows page 0 and page 1, so the patch still carried two of
three pages (315 KB of a 396 KB full response) and took 2.66 s;
- there is no WebSocket/SSE stream yet, only request/response patches;
- layout is still full-document after parsing the whole buffer.
## Architecture