Skip display lists for unchanged pages and profile the build
Patch previews now pass onlyPages into render_json before display-list construction, so unchanged pages skip both glyph-list building and SVG serialization. Late arXiv edits drop to p50 187 ms / p95 232 ms; article-basic stays at 37.5 ms. The gated profiler now reports build_done/layout_done. Release numbers show the real bottleneck is build_document (~196 ms), while page layout is ~2 ms; optimizing the page breaker will not reach <100 ms. Record that finding in the roadmap. Test count stays 1073.
This commit is contained in:
1 parent
d124c646a1
commit
da30705cd0
2 files changed
+21
-8
No files matched your search
@@ -60,19 +60,22 @@ execution is not a goal.
|
|||||||
- `changedPages` already identifies the pages that need repainting.
|
- `changedPages` already identifies the pages that need repainting.
|
||||||
- Incremental bottlenecks:
|
- Incremental bottlenecks:
|
||||||
- release-mode measurements: article-basic warm buffer edit **37.5 ms**
|
- release-mode measurements: article-basic warm buffer edit **37.5 ms**
|
||||||
(one page), arXiv late edit **p50 199 ms / p95 222 ms** (one to two of
|
(one page), arXiv late edit **p50 187 ms / p95 232 ms** (one to two of
|
||||||
three pages changed), arXiv early/heading edit about **480 ms**; a
|
three pages changed), arXiv early/heading edit about **480 ms**; a
|
||||||
one-page simple document meets the <100 ms target, the 3-page arXiv
|
one-page simple document meets the <100 ms target, the 3-page arXiv
|
||||||
template and the 10-page target do not;
|
template and the 10-page target do not;
|
||||||
- patch responses are now serialised only for changed pages; the arXiv late
|
- patch responses are serialised only for changed pages, and display lists
|
||||||
edit still carried one page at 175 KB, and a heading edit carried two at
|
are skipped for unchanged pages; the arXiv late edit still carried one page
|
||||||
315 KB of a 396 KB full response; cache hits return ~170 bytes and 10–40 ms;
|
at 175 KB, and a heading edit carried two at 315 KB of a 396 KB full
|
||||||
|
response; cache hits return ~170 bytes and 10–40 ms;
|
||||||
- the `scripts/bench-preview.py` harness reproduces these numbers: initial
|
- the `scripts/bench-preview.py` harness reproduces these numbers: initial
|
||||||
full, then repeated small buffer edits with HTTP/server latency, bytes and
|
full, then repeated small buffer edits with HTTP/server latency, bytes and
|
||||||
changedPages;
|
changedPages;
|
||||||
- there is no WebSocket/SSE stream yet, only request/response patches;
|
- there is no WebSocket/SSE stream yet, only request/response patches;
|
||||||
- layout is still full-document after parsing the whole buffer; parsing and
|
- release profiling shows the real bottleneck is **build_document**, not page
|
||||||
geometry are only ~10 ms of the release pipeline, so layout is the target.
|
layout: for the arXiv late edit geometry ≈5 ms, paragraphs ≈6 ms,
|
||||||
|
build_document ≈196 ms, layout ≈2 ms. The next optimization must reuse or
|
||||||
|
cache paragraph units/math layout, not the page breaker.
|
||||||
- Developer profiling: `TEXRRA_PROFILE=1` prints geometry/paragraph/before-render
|
- Developer profiling: `TEXRRA_PROFILE=1` prints geometry/paragraph/before-render
|
||||||
timings from the project preview path. Earlier notes in this document used a
|
timings from the project preview path. Earlier notes in this document used a
|
||||||
debug binary (430 ms/2.1 s) and overstate the release latency.
|
debug binary (430 ms/2.1 s) and overstate the release latency.
|
||||||
|
|||||||
+12
-2
@@ -102,6 +102,12 @@ fn project_preview_json_with_images_mode(
|
|||||||
}
|
}
|
||||||
let mut document = build_document(¶graphs, &geometry);
|
let mut document = build_document(¶graphs, &geometry);
|
||||||
apply_geometry(&mut document, &geometry);
|
apply_geometry(&mut document, &geometry);
|
||||||
|
if std::env::var_os("TEXRRA_PROFILE").is_some() {
|
||||||
|
eprintln!(
|
||||||
|
"PROFILE build_done={:.1}ms",
|
||||||
|
started.elapsed().as_secs_f64() * 1000.0
|
||||||
|
);
|
||||||
|
}
|
||||||
let mut sessions = project_sessions()
|
let mut sessions = project_sessions()
|
||||||
.lock()
|
.lock()
|
||||||
.map_err(|_| "route-D session lock".to_string())?;
|
.map_err(|_| "route-D session lock".to_string())?;
|
||||||
@@ -152,7 +158,7 @@ fn project_preview_json_with_images_mode(
|
|||||||
};
|
};
|
||||||
if std::env::var_os("TEXRRA_PROFILE").is_some() {
|
if std::env::var_os("TEXRRA_PROFILE").is_some() {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"PROFILE before_render={:.1}ms",
|
"PROFILE layout_done={:.1}ms",
|
||||||
started.elapsed().as_secs_f64() * 1000.0
|
started.elapsed().as_secs_f64() * 1000.0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -14460,7 +14466,11 @@ fn render_json(
|
|||||||
let mut lists: Vec<DisplayList> = engine
|
let mut lists: Vec<DisplayList> = engine
|
||||||
.pages()
|
.pages()
|
||||||
.iter()
|
.iter()
|
||||||
.map(|page| {
|
.enumerate()
|
||||||
|
.map(|(index, page)| {
|
||||||
|
if only_pages.is_some_and(|pages| !pages.contains(&index)) {
|
||||||
|
return DisplayList::default();
|
||||||
|
}
|
||||||
let mut list =
|
let mut list =
|
||||||
page.display_list_with_layout(document.page_goal, document.text_float_sep);
|
page.display_list_with_layout(document.page_goal, document.text_float_sep);
|
||||||
list.width = list.width.max(document.paper_width);
|
list.width = list.width.max(document.paper_width);
|
||||||
|
|||||||
Reference in new issue
Block a user