Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

UI widgets: mark-dirty-on-change, repaint at most every 100ms

未关闭
#1,093 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
cpp

调研方向

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 内容生成。

描述

enhancement Impact: Medium UI

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++
星标
333
派生
33
平均合并
5 天 13 小时
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Vector35/debugger 的其他 Issue

查看 Vector35/debugger 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。