Skip to content

perf: Establish performance baseline for drawing layers + engine #423

Closed

Description

@cursor

Context

Desktop buddy must not harm system performance. Suspect idle wakeups and GPU compositing of transparent overlays cost too much. This parent tracks the benchmarking plan before any optimization work.

Architecture (from review)

Rust engine tick (~16ms sleep target) → frame loop → per-display transparent Tauri webview (rAF) → platform overlay / compositor.

Overlay/pet is not GTK drawing. Cost is continuous process wakeups + fullscreen-ish transparent window compositing.

Top suspects (unmeasured)

  1. Unconditional ~60Hz wakeups — frame loop keeps ticking when the sprite is still / user AFK
  2. GPU compositing — transparent always-on-top overlays re-composited every vsync
  3. WindowSource polling (macOS) — CGWindowListCopyWindowInfo at 10–60Hz; scales with open window count
  4. Per-pixel click-through mask rebuild (Windows / X11) on animation frames

Full write-up path (may still be local-only): docs/research/drawing-engine-performance.md

Child benchmarks

# Focus
#431 CPU wakeups & idle (macOS)
#432 CPU wakeups & idle (Linux)
#429 GPU compositing (macOS Metal)
#430 GPU compositing (Windows DWM)
#425 GPU compositing (Linux X11/Wayland), out of V1, below
#427 WindowSource poll cost at scale (macOS)
#428 Click-through mask rebuild (Windows/X11)
#424 Memory (RSS) & multi-monitor scaling
#426 Frame cadence & dropped frames, out of V1, below

Each child specifies tools, scenarios (idle perched / walking / chat open / multi-monitor), metrics, and acceptance = baseline numbers in a doc/PR.

Out of V1: needs Linux plus GPU or multi-monitor hardware. These don't count toward V1 done. They stay open with no milestone until a bare-metal Linux machine with a GPU or multiple monitors is available:

Out of scope here

  • Implementing optimizations (open after baselines)
  • Controlled battery runs (defer until we have CPU/GPU numbers)
  • Wayland-native (still X11-first for V1)

Done when

  • Child baselines filled in
  • Top 3 optimization targets ranked from data
  • Results in docs/research/performance-baseline-v1.md

— Cursor agent, on @omesser's behalf.

Activity

  1. added this to the V1 milestone on Sep 6, 2026
  2. omesser commented on Sep 6, 2026

    @omesser
    Owner

    Existing fix track (do not duplicate)

    #183 already owns the unconditional 60Hz frame-loop poll — the top idle-cost suspect in this plan. It is a Stage 1 permission spike (macOS mouse-only CGEventTap) then Stage 2 event-driven input / two-clock scheduler (timer only while motion needs it; block on recv() when still). Research: docs/research/event-driven-input-vs-polling.md (#241).

    How the new issues relate

    Treat #183 as the leading optimization ticket for wakeups; this parent stays measurement + ranking.

    — Cursor agent, on @omesser's behalf.

  3. added
    p2Eventually: real, but nothing waits on it
    on Sep 9, 2026
  4. omesser commented on Sep 23, 2026

    @omesser
    Owner

    Progress (not done)

    #927 added the Linux section of docs/research/performance-baseline-v1.md (idle perched + no-buddy baseline on a headless Ubuntu VM).

    Child #432 stays open: full scenario matrix / C-states / real-desktop powertop still needed. Other children unchanged. This parent stays open until child baselines fill in and top targets are ranked.

    — Cursor agent (Coder), on @omesser's behalf.

  5. omesser commented on Sep 26, 2026

    @omesser
    Owner

    Progress (not done)

    #1034 closed child #429: macOS Metal GPU compositing matrix is on main in docs/research/performance-baseline-v1.md (plus scripts/bench-gpu-compositing-macos.sh). Predicted idle GPU cost and multi-monitor doubling are refuted on the measured machine; hide-rule saving shows up as engine ticks, which keeps ranking pressure on wakeups.

    Sibling status after this merge: closed #429 / #430 / #431; open #424 / #425 / #426 / #427 / #428 / #432. This parent stays open until remaining child baselines fill in and top targets are ranked.

    — Cursor agent (Coder), on @omesser's behalf.

  6. omesser commented on Sep 26, 2026

    @omesser
    Owner

    Progress (not done)

    #1042 partially landed child #427: WindowSource poll matrix (idle/riding × ~55 / ~155 windows) is on main in docs/research/performance-baseline-v1.md, with the bench scripts. Screenshot + plotted curve still open on #427; flood helper is #1043.

    Sibling status after this merge: closed #429 / #430 / #431; open #424 / #425 / #426 / #427 / #428 / #432. This parent stays open until remaining child baselines fill in and top targets are ranked.

    — Cursor agent (Coder), on @omesser's behalf.

  7. omesser commented on Oct 1, 2026

    @omesser
    Owner

    Completed — #1203 on main

    Merge: d85fa2a12a501187f1d1da843bc86c0366601025.

    Acceptance for this parent is met on main:

    • Child baselines are rolled into docs/research/performance-baseline-v1.md (closed children cited; open children have measured rows or an explicit unavailable reason).
    • Top 3 optimization targets ranked from measured ms of one core per second: software paint of a moving overlay; click-through mask rebuild under the pointer; macOS WindowSource while riding with many windows.
    • Results live in that document; bench scripts gained --bin / XAUTHORITY fixes in the same PR.

    Open children (#432, #425, #428, #424, #426) keep their leftover measurement gaps — those are separate jobs, not blockers for this parent.

    — Cursor agent (Coder), on @omesser's behalf.

  8. omesser commented on Oct 23, 2026

    @omesser
    Owner

    Post-merge check after #1798 (merged at 350dcece). Each "Done when" item, checked against docs/research/performance-baseline-v1.md on main:

    Ticked all three. The issue stays closed as completed.

    One small doc drift, not a blocker: the status table still lists #424 as "Open" (L38), but #424 is closed.

    — Cursor agent (P. Coder), on @omesser's behalf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2Eventually: real, but nothing waits on itperformanceCPU/GPU/memory/idle cost and benchmarking

    Projects

    • Status
      Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions