Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#1,093 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
cpp
Lĩnh vực
desktop, performance

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
C++
Star
333
Fork
33
Merge trung bình
5 ngày 13 giờ
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Vector35/debugger

Tất cả issue của Vector35/debugger

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.