Skip to content

Cut warm popup open from ~84ms to ~35ms to first frame - #55

Closed
mstallone wants to merge 10 commits into
perf/ui-01-profiler-harnessfrom
perf/ui-02-close-pays-for-close
Closed

mstallone wants to merge 10 commits into
perf/ui-01-profiler-harnessfrom
perf/ui-02-close-pays-for-close

Conversation

@mstallone

Copy link
Copy Markdown
Owner

TL;DR — Warm popup open drops from ~84ms to ~35ms click-to-first-frame (upstream openusage measures 42ms with half our content). Three changes: per-view TimelineViews gated on visibility become one shared observable clock, the panel height is retained across closes instead of reset to 0, and the close settles the hidden tree so the next open finds it clean.

What was happening

  • Every dated metric row (and the footer countdown) wrapped its content in TimelineView behind an if popoverIsVisible gate. The panel's SwiftUI tree survives orderOut, so each open AND close was a structural branch swap that tore down and rebuilt every dated row's subtree — measured as the largest cost in the open's pre-show layoutSubtreeIfNeeded (~57ms avg).
  • Closing reset animatedHeight to the 0 sentinel, so each reopen walked 0 → target: a root frame change that forced a second full-tree layout.
  • The close's cleanup (card collapse, scroll reset) sat in pending transactions until the next open flushed them.

What this changes

  • DashboardClock (new): one 1s/30s wall clock owned by AppContainer, started/stopped at the panel show/hide chokepoints. Rows and the footer read it via observation — stable view structure, no ticks while closed, fresh stamps on open. Environment reads are optional so ImageRenderer share cards (no clock) stay static, matching prior behavior.
  • DashboardView keeps animatedHeight across closes; the reopen seed and the hidden collapsed re-measure walk it un-animated, and same-value seeds are skipped.
  • hidePanel() runs layoutSubtreeIfNeeded() on the hidden tree so close pays for close (~34ms, invisible), replacing the ~70–100ms post-close display-cycle stall.

Heads-up

  • Row tick cadence and countdown behavior are unchanged from the user's perspective (docs/dashboard.md's "tick every 30 seconds" still holds).
  • The measured stall count for the warm open/close phase went from 24 (≈1.9s total) to 1.

Tests

  • Full suite passes (1529 tests). New DashboardClockTests. script/profile_ui.sh before/after on this machine: open.toFirstRunloopTurn 84.1ms → 35.6ms avg; close.syncTotal 3.6ms+deferred-stall → 34.1ms all-inclusive.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a961b08cfe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a4c5e211fb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@mstallone
mstallone deleted the branch perf/ui-01-profiler-harness August 2, 2026 07:40
@mstallone mstallone closed this Aug 2, 2026
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