diff --git a/docs/P2_M1_PROGRESS.md b/docs/P2_M1_PROGRESS.md index 0bd4868..ed41661 100644 --- a/docs/P2_M1_PROGRESS.md +++ b/docs/P2_M1_PROGRESS.md @@ -621,6 +621,40 @@ SHA-256 为 `ae44671f7d0cee93ab3a32008ec4ef82ec52ef61020be6ecd3eac1d8512b5b72` [TeX Live 正则实现](https://github.com/TeX-Live/texlive-source/blob/trunk/texk/web2c/pdftexdir/utils.c#L762-L852) [GNU C 库匹配接口](https://sourceware.org/glibc/manual/latest/html_node/Matching-POSIX-Regexps.html) +### 变更账本与草稿产物并行同步 + +原三页用例的辅助文件保持原样,30 次修订在公开会话回调分段取样。 +项目准备、执行、布局及字体、PDF 导出、草稿整理的 p95 分别为 +3.034、4.588、0.055、3.722、2.519 ms。草稿整理之后到提交返回的 +p95 为 396.861 ms。阶段边界按每次实际观测计算。 + +在同一个三页用例中,同时编辑颜色对象与实际写出的 aux,使账本 +随真实生成文件变更。前版每次在 PDF、日志和 aux 同步都结束后才 +同步账本。现由同一私有暂存组同步账本,所有同步完成后核对账本的 +最终字节和文件身份,再进入同一安装门禁。每版 6 次系统调用跟踪中, +前版 6 次的账本同步与其余文件串行,新版 6 次均有实际重叠, +时间为 157.018 至 275.242 ms。跟踪的 12 次都在四份文件同步成功后 +开始替换。覆盖错误回滚、取消、账本校验和草稿发布的四项定向回归通过。 + +原样 Elsevier CAS JPEG、同一机器及项目设置下,每版 30 次热编辑, +分三组轮换顺序。60 次都只更新第二页。草稿 SVG 等于发布 SVG,PDF、 +已应用的页预览、来源映射与 aux 等于相同输入的独立全量。下表单位为 ms。 + +| 测量区间 | 前版 p50 | 前版 p95 | 新版 p50 | 新版 p95 | +| --- | ---: | ---: | ---: | ---: | +| 草稿 SVG 交付 | 11.290 | 13.454 | 11.815 | 14.265 | +| 草稿 SVG 至发布完成 | 282.339 | 756.171 | 171.469 | 232.786 | +| 收到修订至发布及差量返回 | 292.422 | 768.276 | 183.061 | 247.056 | + +此项缩短账本已变更时的发布等待。原样分规模项目的浏览器可见延迟仍须统一 +验收。运行压力、峰值 RSS 和真实系统调用见 `target/p4-live-stage-latency`。 +回执 `receipt.json` 的 SHA-256 为 `8d059b5ba4067d6ce1cd4a0cabed7514864d1496775b0196c6b82b3f1e070394`。 + +后续格式兼容用例保存在 `target/p4-live-stage-latency/next-preboxed`。 +实际 pdfTeX 转储再加载含命名 PDF 页的盒子,新作业报告 2621440 × +2654623 sp 并产生一页 PDF。原生从同一输入执行到 `\dump` 时拒绝 +注册过的图像;保留失败诊断和原版格式镜像以供后续对照。 + ### PDF 预览按实际页面资源复用 编译会话的 SVG 缓存采用预览读取器解析出的页面、有效页框、旋转和资源。 diff --git a/src/native_job.rs b/src/native_job.rs index ff23fb9..0c00989 100644 --- a/src/native_job.rs +++ b/src/native_job.rs @@ -1315,8 +1315,18 @@ impl PendingDraft { } Ok(()) }; - // Flush independent files concurrently, then finish collecting all - // results before the revision gate can install any artifact. + let sync_ledger = || -> Result<(), String> { + if let Some(ledger) = &draft.ledger + && !cancellation.is_cancelled() + { + ledger.file.sync_all().map_err(|e| { + format!("sync native draft ledger {}: {e}", draft.ledger_target.path.display()) + })?; + } + Ok(()) + }; + // Flush independent files concurrently and collect all results + // before the revision gate can install any artifact. std::thread::scope(|scope| { let pdf_worker = pdf .as_ref() @@ -1331,6 +1341,11 @@ impl PendingDraft { .spawn_scoped(scope, sync_log) .ok() }); + let ledger_worker = draft.ledger.as_ref().and_then(|_| { + std::thread::Builder::new() + .spawn_scoped(scope, sync_ledger) + .ok() + }); let generated = artifacts.iter().try_for_each(|artifact| { if cancellation.is_cancelled() { return Ok(()); @@ -1356,7 +1371,12 @@ impl PendingDraft { .join() .map_err(|_| "native draft log sync thread panicked".to_owned())? }); - pdf_result.and(log_result).and(generated) + let ledger_result = ledger_worker.map_or_else(sync_ledger, |worker| { + worker + .join() + .map_err(|_| "native draft ledger sync thread panicked".to_owned())? + }); + pdf_result.and(log_result).and(generated).and(ledger_result) })?; drop(log); if cancellation.is_cancelled() { @@ -1364,6 +1384,7 @@ impl PendingDraft { } artifacts.push(draft.log); let untouched_ledger = if let Some(DraftLedger { file, staged }) = draft.ledger { + // Verify the final staged bytes after the other syncs finish. let target = &draft.ledger_target.path; let actual = fs::symlink_metadata(&staged.path).map_err(|e| e.to_string())?; let descriptor = file.metadata().map_err(|e| e.to_string())?; @@ -1377,8 +1398,6 @@ impl PendingDraft { target.display() )); } - file.sync_all() - .map_err(|e| format!("sync native draft ledger {}: {e}", target.display()))?; drop(file); artifacts.push(DraftArtifact { target: draft.ledger_target,