Serialise only changed pages for patch previews

render_json now accepts an optional page whitelist. The new
project_preview_patch_json_with_images path passes changedPages before building
page SVGs, instead of serialising all pages and filtering afterwards in the
server. Cache hits still use the old filter helper.

Add scripts/bench-preview.py: repeated buffer edits against a running server,
reporting HTTP/server latency, bytes and changedPages. Measure release builds:
article-basic 37.5 ms (one page), arXiv late edit p50 199 ms / p95 222 ms with
one changed page at 175 KB, arXiv heading edit ~480 ms. This is a solid
improvement over the debug numbers previously quoted, but the 10-page <100 ms
target remains unmet.

TEXRRA_PROFILE=1 now gates the geometry/paragraph/before-render timings. Test
count is 1073 (67 server).
This commit is contained in:
gloamxun committed 2026-10-27 21:36:01 +08:00
1 parent 9231c3a7d6
commit d124c646a1
4 files changed
+162 -14

No files matched your search

+8 -7
View File
@@ -1584,15 +1584,16 @@ fn handle_project_request(
};
return respond_json_engine(request, 200, &body, "route-d");
}
match route_d::project_preview_json_with_images(id, &expanded, &images) {
let patch = query_param(url, "patch").is_some();
let result = if patch {
route_d::project_preview_patch_json_with_images(id, &expanded, &images)
} else {
route_d::project_preview_json_with_images(id, &expanded, &images)
};
match result {
Ok(json) => {
store_route_d_preview(key, json.clone());
let body = if query_param(url, "patch").is_some() {
patch_preview_json(&json).unwrap_or(json)
} else {
json
};
return respond_json_engine(request, 200, &body, "route-d");
return respond_json_engine(request, 200, &json, "route-d");
}
Err(_) => {}
}