Skip to content

perf: improve responsiveness for 120 Hz displays - #123

Merged
qeude merged 14 commits into
mainfrom
t3/performance-fluidity-120fps
Oct 9, 2026
Merged

qeude merged 14 commits into
mainfrom
t3/performance-fluidity-120fps

Conversation

@qeude

@qeude qeude commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Parallelize and coalesce window geometry reads while preserving a serial fast path.
  • Keep discovery retries isolated from the global watchdog and skip unchanged intermediate frame writes.
  • Reject stale focus mutations and verify final geometry after Accessibility updates.
  • Add regression and performance workloads for discovery, focus, frame writes, and observation campaigns.

Testing

  • python3 script/verify.py local — not run in this content-generation task.

View guided diff Turn on auto-fix

Note

Improve display responsiveness: async border-geometry reads, incremental discovery, and retry scheduling

  • Moves border-geometry native reads off the main thread into per-process coalesced read lanes in AXFrameCoordinator, so repeated requests for the same window collapse into one read and observations are delivered as a batch on the main actor
  • Adds prepared incremental window discovery: SnapshotEngine.prepareIncrementalDiscoveryReads reuses cached element bindings and window attributes, defers processes that need no read, and schedules per-process unmatched-window retries with deadlines
  • Adds frame-commit verification tracking in SnapshotEngine, with commit IDs, scheduled/requested/watchdog states, and due-verification checks wired into the daemon refresh and desktop-sync decisions
  • Replaces independent delayed focus/lifecycle/creation callbacks with generation-aware observation campaigns in DelayedObservationCampaigns, so stale deliveries are discarded
  • Adds a large regression and performance test suite (virtual clocks, injected measurement access, synthetic fixtures) plus a Python experiment harness in script/performance_experiments.py
  • Behavioral Change: window/frame observations are now accepted only when their commit ID, target frame, border-binding revision, element, process, and application still match; stale or mismatched reads return no frame instead of being applied. AXFrameWriter skips Accessibility mutations when the focus request is no longer current. MacOSPlatform.refreshWindowBorderGeometry(for:) was removed in favor of the queued multi-window path.

Macroscope summarized 6bb25c2.

Comment thread Sources/DefiDaemon/DefiDaemon.swift

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 49 files

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread script/performance_experiments.py Outdated
Comment thread Tests/DefiMacOSTests/IncrementalDiscoveryPerformanceTests.swift
Comment thread Tests/DefiMacOSTests/DiscoveryRetryCorrectnessTests.swift
Comment thread Tests/DefiMacOSTests/FrameGeometryReadTests.swift
Comment thread Sources/DefiMacOS/MacOSPlatform+Snapshot.swift
Comment thread Tests/DefiMacOSTests/FrameComponentPerformanceTests.swift Outdated
Comment thread Sources/DefiMacOS/AXFrameCoordinatorWrites.swift
Comment thread Sources/DefiDaemon/DefiDaemon.swift
@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[High impact] The changes since the previous review appear safe to merge.

Summary

This PR improves window discovery, coalesces geometry reads, skips unchanged frame writes, and checks final window geometry after Accessibility updates.

  • Since the previous review, only two tests changed. They now use dedicated threads for blocking concurrency checks.
  • No new actionable issues or repository-rule violations were found.
  • The earlier retry-ID cleanup concern is addressed: finished campaigns remove their IDs, and replacement campaigns receive new IDs.
  • Tests were not run. The macOS-only checks cannot run in this Linux environment.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Window events] --> B[Coalesce geometry requests]
  B --> C[Read on each process queue]
  C --> D[Check window identity and freshness]
  D --> E[Update cached geometry and borders]
  F[Accessibility frame writes] --> G[Schedule final geometry check]
  G --> H[Read actual window frame]
  H --> I{Matches target?}
  I -->|Yes| J[Retire the check]
  I -->|No| K[Request frame correction]
Loading

Reviews (4) · Last reviewed commit: "fix: fix CI failure on PR #123" · Reviewed by Greptile

Comment thread Sources/DefiMacOS/DelayedObservationCampaigns.swift
@macroscopeapp

macroscopeapp Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This is a large production-path redesign affecting accessibility reads and writes, window discovery scheduling, focus handling, border rendering, and frame verification rather than a narrowly scoped responsiveness tweak. The unresolved review comments also identify retry-timing, host-dependent test, and extra-mutation risks that require human assessment.

Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more.

@qeude
qeude merged commit 3b4a8b6 into main Oct 9, 2026
5 checks passed
@qeude
qeude deleted the t3/performance-fluidity-120fps branch October 9, 2026 07:54
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.

1 participant