Skip to content

[6021] 优化渐进式排版引擎性能:增量调度加速与全生命周期基准度量 - #4722

Merged
da-liii merged 3 commits into
mainfrom
da/6021/progressive_typeset_perf
Oct 14, 2026
Merged

da-liii merged 3 commits into
mainfrom
da/6021/progressive_typeset_perf

Conversation

@MoonL79

@MoonL79 MoonL79 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

概要

优化渐进式流式排版调度机制与生命周期性能监控:

  1. 全生命周期基准监控:在流式排版启动时通过 bench_start ("progressive_typeset: " * doc_name) 埋点,排版彻底完成时调用 bench_end ("progressive_typeset: " * doc_name, 0) 输出整书排版端到端总耗时;
  2. 新增专用的 THE_PROGRESSIVE 变更掩码(1024):将视口外后台排版与重量级编辑通知(THE_TREE)解耦;排版切片不在视口内时跳过 find_check_cursor、选区重算、菜单刷新与脏区重绘上屏,仅更新后台 Box 与滚动条范围(set_extents);
  3. 消除视口外强行延时(Zero-Delay Pipeline):视口外后台排版移除 200ms 强制延时等待,通过 needs_update () 在 Qt 空闲队列以满吞吐率极速连续推进;
  4. 动态自适应批处理步长:默认段落步长由 10 提升至 50,并基于 25ms 预算根据单次切片耗时动态自适应调节步长;
  5. 优化 position_at 遍历:限制 position_at 对历史已冻结成熟页面的全量遍历,降低深层页面累积带来的遍历开销。

实测效果:xiyouji.stem(5,896 个段落,433 页)完整排版总耗时由 120 秒以上大幅下降至 3.2 秒以内,吞吐量提升近 40 倍。

@da-liii da-liii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@da-liii
da-liii merged commit 2b1f186 into main Oct 14, 2026
6 checks passed
@da-liii
da-liii deleted the da/6021/progressive_typeset_perf branch October 14, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants