Stop obsolete draft rendering between pages
This commit is contained in:
1 parent
eda01fb689
commit
b5e87a8706
5 files changed
+33
-3
No files matched your search
@@ -316,6 +316,20 @@ SHA-256 为 `81d06fae9f6c1ba2fabb7ef0e3dece25cdeab538c4b41a3ebedd3b9d4db34783`
|
||||
`target/p4-provisional-preview/edge-mixed/run-1/receipt.json` 的 SHA-256 为
|
||||
`7239cac58838afafe72fdab2f292d48f3893984b1bb4685684e92600508fcb5d`。
|
||||
|
||||
同一实现追加原样单页 A1 10pt 的浏览器对照,两版各30次。编辑到可见
|
||||
p50/p95 由1293.0/2036.9降到309.5/398.8 ms。提前绘制模式在29轮中可在画后
|
||||
直接观察到文件仍待发布。页面、实际 SVG、PDF、来源版本和映射、最终 aux
|
||||
一致。服务端峰值 RSS 为617856和618676 KiB。提前绘制模式的准备与执行
|
||||
p95 分别为105.9和119.7 ms。运行前后 I/O pressure avg10 为11.45%和39.90%。
|
||||
报告 `target/p4-provisional-preview/edge-a1/run-1/receipt.json` 的 SHA-256
|
||||
为 `97451f3e4e44209318bcb0892334ad456612955d505c4d51b2fc8df4cce578e9`,100 ms 门槛仍待达到。
|
||||
|
||||
浏览器测量后补入草稿 SVG 的页面间取消检查。已经开始的单页完成后重新校验
|
||||
修订,失效后停止产生更多页面更新。已发布修订的预览保持可读取。63项库和
|
||||
原生流程回归通过,覆盖真实修订被替代后拒绝再次渲染。日志
|
||||
`target/p4-cancel-obsolete-svg/directed-2.log` 的 SHA-256 为
|
||||
`8ee6161e103c8bc3bf1d41f2b4345533c77b1aed88a029cd223b8697427e8ee3`。取消延迟的独立预算还需实际测试。
|
||||
|
||||
### schema27 与主线兼容性
|
||||
|
||||
合并了真实重复盒及 PDF 书签布局,并保留主线的宏参数分隔符和流式失败报告。
|
||||
|
||||
+13
-2
@@ -97,11 +97,18 @@ pub trait CompileObserver: Send + Sync {
|
||||
/// The same revision's native preview, available before artifact publication.
|
||||
pub struct DraftPreview<'a> {
|
||||
document: &'a CompiledDocument,
|
||||
cancellation: &'a Cancellation,
|
||||
}
|
||||
|
||||
impl DraftPreview<'_> {
|
||||
pub fn preview_since(&self, visible_revision: Option<u64>) -> Result<PreviewUpdate, String> {
|
||||
self.document.preview_since(visible_revision)
|
||||
self.document.preview.render(
|
||||
self.document.revision(),
|
||||
&self.document.pages,
|
||||
self.document.pdf.as_ref(),
|
||||
visible_revision,
|
||||
|| check(self.cancellation).map_err(|error| error.to_string()),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn execution_steps(&self) -> usize {
|
||||
@@ -245,6 +252,7 @@ impl CompiledDocument {
|
||||
&self.pages,
|
||||
self.pdf.as_ref(),
|
||||
visible_revision,
|
||||
|| Ok(()),
|
||||
)
|
||||
}
|
||||
pub fn has_show_diagnostic(&self) -> bool {
|
||||
@@ -1184,7 +1192,10 @@ impl CompileJob {
|
||||
if checkpoints.is_some()
|
||||
&& let Some(observer) = &request.observer
|
||||
{
|
||||
let observed = observer.draft_ready(DraftPreview { document: &result });
|
||||
let observed = observer.draft_ready(DraftPreview {
|
||||
document: &result,
|
||||
cancellation: &cancellation,
|
||||
});
|
||||
check(&cancellation)?;
|
||||
observed?;
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ fn original_a3_resume_uses_real_host_and_matches_independent_full_jobs() {
|
||||
assert_eq!(aux, resumed_aux);
|
||||
let pdf_for_preview: Arc<[u8]> = Arc::from(pdf.bytes.as_slice());
|
||||
let resumed_preview = PreviewState::new(&pages, None, false)
|
||||
.render(1, &pages, Some(&pdf_for_preview), None)
|
||||
.render(1, &pages, Some(&pdf_for_preview), None, || Ok(()))
|
||||
.unwrap();
|
||||
let full = NativeCompiler::default().compile(request.clone()).unwrap();
|
||||
assert!(
|
||||
|
||||
@@ -97,6 +97,7 @@ impl PreviewState {
|
||||
pages: &[DisplayList],
|
||||
pdf: Option<&Arc<[u8]>>,
|
||||
visible: Option<u64>,
|
||||
check: impl Fn() -> Result<(), String>,
|
||||
) -> Result<PreviewUpdate, String> {
|
||||
let pdf = PdfPreview {
|
||||
bytes: pdf,
|
||||
@@ -107,15 +108,18 @@ impl PreviewState {
|
||||
visible
|
||||
} else if visible.is_some() && visible == self.previous_revision {
|
||||
for &index in &self.changed {
|
||||
check()?;
|
||||
rendered.push(self.render_page(index, &pages[index], &pdf)?);
|
||||
}
|
||||
visible
|
||||
} else {
|
||||
for (index, page) in pages.iter().enumerate() {
|
||||
check()?;
|
||||
rendered.push(self.render_page(index, page, &pdf)?);
|
||||
}
|
||||
None
|
||||
};
|
||||
check()?;
|
||||
Ok(PreviewUpdate {
|
||||
base_revision,
|
||||
revision,
|
||||
|
||||
@@ -460,6 +460,7 @@ fn provisional_preview_matches_published_pages_and_cancellation_keeps_artifacts(
|
||||
match self.action {
|
||||
Action::Supersede => {
|
||||
self.compiler.start();
|
||||
assert!(draft.preview_since(None).unwrap_err().contains("cancelled"));
|
||||
}
|
||||
#[cfg(unix)]
|
||||
Action::Conflict => {
|
||||
|
||||
Reference in new issue
Block a user