UI widgets: mark-dirty-on-change, repaint at most every 100ms
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 55/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 冷清
- 技術堆疊
- cpp
- 領域
- desktop, performance
研究方向
Start in the widget implementations under ui/ and audit the listed consumers: register, stack, thread frames, modules, locals, IP highlight, statusbar, breakpoint, TTD/bookmark, and stdout views. Trace their debugger-event callbacks and classify snapshot versus transition handling before applying the proposed timer approach. Done means snapshot widgets coalesce updates while transition and append handlers retain every event.
由索引模型根據 Issue 內容生成。
描述
Follow-up to the worker-queue / state-on-worker discussion (#1090, #1088, #1089).
Problem
Every debugger event currently drives an immediate UI update on the dispatcher thread. Each widget that subscribes (register view, stack view, thread frames, modules, locals, IP highlight, statusbar, …) reacts inline. That's fine at normal user pace, but it caps the maximum stepping rate at "how fast can Qt repaint all the widgets," which is far slower than the engine can step.
Concretely: holding F11 to step rapidly today, the user gets maybe a dozen steps per second because each step's TargetStoppedEvent triggers a synchronous fan-out to every widget, each of which repaints. Most of those repaints are pure waste — the user only cares about the final state once they stop holding F11.
Proposed change
Two pieces:
1. Mark-dirty in callbacks; render on a timer
Each widget that consumes "snapshot"-style events (target stopped, register changed, active thread changed — anything where only the latest matters) does the following in its event callback:
void RegisterWidget::onDebuggerEvent(const DebuggerEvent&) {
m_dirty = true;
// do not call update() or repaint or fetch state here
}
A QTimer running at ~10Hz (every 100ms) checks the dirty flag and, if set, fetches the current state and triggers update():
void RegisterWidget::onFrameTick() {
if (!m_dirty) return;
m_dirty = false;
m_snapshot = m_controller->GetState()->GetRegisters();
update();
}
1000 events arrive between two timer ticks → dirty flipped 1000 times → one repaint with the freshest state.
2. Per-widget audit for snapshot vs. transition semantics
Not every event is "snapshot" semantics. Things like BreakpointChangedEvent are transitions (each one mutates a list; coalescing would lose information). Audit each widget and apply the dirty-bit pattern only to the snapshot subscribers; leave transition handlers running inline.
Suggested classification (verify per-widget):
| Widget | Snapshot or transition? | Treatment |
|---|---|---|
| Register view, stack view, IP highlight, locals, statusbar | snapshot (cares about latest state) | dirty-bit + 100ms timer |
| Module list | mostly transition but rarely changes during run | dirty-bit + timer fine (low rate) |
| Thread frames | snapshot | dirty-bit + timer |
| Breakpoint widget | transition | inline (low rate already) |
| TTD events / bookmarks | append/transition | inline |
| Stdout pane | append | inline + Qt's own buffering |
Why 100ms
It's slow enough that 1000 events coalesce into ~10 repaints (back-of-envelope), fast enough that the user perceives the updates as live. A perfect setting may be 50–150ms depending on widget cost; configurable per-widget if needed.
What this enables
Combined with Step(count=N) batching at the controller level (separate proposal), users holding F11 would see the engine actually run at engine speed — limited by adapter step latency rather than UI repaint cost. The two are complementary:
Step(count=N)collapses N user steps into one engine session, reducing the number of events fired.- The dirty-bit pattern ensures that when events DO fire rapidly (for any reason, not just stepping — also during target activity bursts like rapid module loads), the UI doesn't lag indefinitely behind.
Out of scope
- Changing the event model / dispatcher contract (covered in earlier discussions). This proposal is purely on the widget consumer side.
- Coalescing inside the broadcast queue (would require classifying events at the controller level; nice but bigger).
- Snapshot-pointer / "always-fresh" rendering for high-rate widgets (would bypass events entirely; only worth doing if 100ms still isn't responsive enough).
Estimated scope
Each widget that opts in is ~15 lines: a member dirty flag, a QTimer, a slot. There are ~10 candidate widgets in ui/. Could land as one widget per PR or all in one focused refactor — they're independent.
- 主要語言
- C++
- 星號
- 338
- 分支
- 33
- 平均合併
- 7 天 1 小時
- 30 天內合併 PR
- 8
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
Vector35/debugger 的其他 Issue
-
bug Effort: Trivial
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
bug Effort: Trivial Impact: Low
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 95/100
維護者通常 1 天內回覆
-
Effort: Trivial enhancement UI
難度 2/5 1-3 小時 新手友好度 65/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
Vector35/debugger#1148 · 1 則留言 ·
維護者通常 1 天內回覆
查看 Vector35/debugger 的全部 Issue
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 88/100
維護者通常 1 天內回覆
-
new issue
難度 2/5 1-3 小時 新手友好度 72/100
llvm/llvm-project#240065 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 65/100
維護者通常 2 天內回覆
-
ai_p2
難度 2/5 1-3 小時 新手友好度 82/100
ClickHouse/ClickHouse#130006 ·
維護者通常 1 天內回覆
-
RebuildGeom rebuilds vertex buffers needlessly可能已有人在做 @trish-sl 今天認領。 未關閉triage
難度 2/5 1-3 小時 新手友好度 76/100
secondlife/viewer#6653 ·
維護者通常 1 天內回覆