Skip to content

perf(web-ui): reduce post-interactive workspace and session pressure#1032

Open
limityan wants to merge 1 commit into
GCWing:mainfrom
limityan:yanzhn/startup-m2-pressure
Open

perf(web-ui): reduce post-interactive workspace and session pressure#1032
limityan wants to merge 1 commit into
GCWing:mainfrom
limityan:yanzhn/startup-m2-pressure

Conversation

@limityan
Copy link
Copy Markdown
Collaborator

@limityan limityan commented Jun 2, 2026

Summary

  • Defer complete historical-session hydration with browser idle scheduling after the latest tail is available.
  • Defer inactive local workspace basic Git refresh during startup, while refreshing on activation or menu open so workspace actions do not stay stale. Remote workspace rows keep the existing default behavior.
  • Keep the restored-session loading placeholder while the virtualizer catches up, preventing the input box from briefly falling back to the centered new-session welcome layout.

Updates #949. This PR does not close the issue; follow-up work is still needed for larger startup and session-list wins.

Performance Data

Environment: Windows desktop release-fast build after rebasing onto latest main (b06d0efc), candidate cf0b337, 5 cold-launch runs and 5 long-session first-open runs, p50. Baseline is the post-M1 #1015 head sample.

Key End-to-End Scenarios

User scenario Baseline p50 This PR p50 Delta Reading
Cold launch until main window is visible 593.4 ms 564.8 ms -28.6 ms (-4.8%) Modest improvement
Cold launch until chat UI is usable 778.4 ms 745.2 ms -33.2 ms (-4.3%) Modest improvement
Cold launch until background non-critical init is done 1296.3 ms 1269.9 ms -26.4 ms (-2.0%) Slight improvement
First open of 80-turn historical session until latest content first frame 166.1 ms 152.0 ms -14.1 ms (-8.5%) Modest improvement
First open of 80-turn historical session until complete history first frame 360.8 ms 335.5 ms -25.3 ms (-7.0%) Modest improvement

Startup Pressure Breakdown

Startup work Baseline p50 This PR p50 Delta Reading
Startup API command count 40 35 -5 (-12.5%) Reduced startup work
Sum of startup API command durations 4704.5 ms 2680.0 ms -2024.5 ms (-43.0%) Lower backend/bridge pressure; this is summed command duration, not wall-clock
Workspace repository checks 4 calls / 979.3 ms 1 call / 262.3 ms -3 calls / -717.0 ms (-73.2%) Inactive local rows no longer refresh on startup
Workspace basic Git info 4 calls / 284.5 ms 2 calls / 81.7 ms -2 calls / -202.8 ms (-71.3%) Inactive local rows no longer refresh on startup
Session metadata page loading 5 calls / 324.0 ms 5 calls / 377.5 ms +53.5 ms (+16.5%) No improvement; one run had a 1401.9 ms outlier

Long Session Breakdown

First-open work Baseline p50 This PR p50 Delta Reading
Restore selected session base state 47.6 ms 45.9 ms -1.7 ms (-3.6%) Slight improvement
Load latest visible session data 109.8 ms 109.5 ms -0.3 ms (-0.3%) Flat
Latest data ready to first rendered frame 42.5 ms 38.5 ms -4.0 ms (-9.4%) Slight render-path improvement
Background complete-history hydrate 36.0 ms 42.9 ms +6.9 ms (+19.2%) Small absolute regression; latest-content path remains faster

Risks And Functional Impact

  • The visible benefit is modest end-to-end improvement plus a clear reduction in post-interactive startup API/Git pressure; this is not a large first-screen optimization.
  • Complete historical-session hydration now waits for browser idle or a timeout after the latest tail is rendered. Users should see recent content first, but very fast scrolling into older history can still depend on the background hydrate.
  • Background complete-history hydrate regressed by +6.9 ms p50. The end-to-end complete-history first frame still improved by -25.3 ms, but this remains a watch item.
  • Inactive local workspace Git state is deferred. Opening the row menu triggers a basic refresh and shows a loading state before Git-dependent actions become available.
  • Remote workspace Git behavior is intentionally unchanged in this PR.
  • Session metadata page loading regressed by +53.5 ms p50 and had a 1401.9 ms outlier in the final 5-run sample. Session metadata remains a required follow-up target.
  • The restored-session placeholder guard is intentionally defensive: if a ready session has turns but the virtualizer has not emitted items yet, the UI shows the saved-session loading shell instead of the new-session welcome layout, avoiding the centered input-box fallback.
  • The release-fast perf harness still logs an existing dynamic-import warning in the bundled app. The perf test passes and the warning is not introduced by this PR.

Verification

  • pnpm --dir src/web-ui run test:run src/app/components/NavPanel/sections/workspaces/workspaceGitRefreshOptions.test.ts
  • pnpm --dir src/web-ui run test:run src/flow_chat/store/FlowChatStore.test.ts
  • pnpm --dir src/web-ui run test:run src/flow_chat/components/modern/ModernFlowChatContainer.history-state.test.tsx
  • pnpm --dir src/web-ui run test:run src/flow_chat/services/storeSync.test.ts
  • pnpm run type-check:web
  • git diff --check gcwing/main...HEAD
  • pnpm --dir tests/e2e run fixture:long-session -- --workspace <repo>
  • pnpm run desktop:build:release-fast
  • pnpm run e2e:test:perf:release-fast repeated 5 times after final rebase

@limityan limityan force-pushed the yanzhn/startup-m2-pressure branch from 966ef58 to cf0b337 Compare June 2, 2026 05:58
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