Skip to content

perf(flow-chat): reduce historical session hydration stalls#1108

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/perf-session-hydrate-p0-p1
Jun 8, 2026
Merged

perf(flow-chat): reduce historical session hydration stalls#1108
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/perf-session-hydrate-p0-p1

Conversation

@limityan

@limityan limityan commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Reduce historical-session first-open and switch stalls by rendering the latest readable tail first and hydrating older history after the latest content is stable.
  • Prevent rapid session switching from syncing/opening a stale session after a newer target becomes active.
  • Add strict E2E guards for latest-anchor failures, post-visible loading/blank/scroll-jump regressions, and rapid-switch non-target content holds.
  • Add native startup trace breakdown for tray/window creation so startup outliers are visible.

Status

Merged as b34a970c.

A post-merge review found one additional P2 interaction risk in the old-history window expansion scroll mapping. That follow-up fix is tracked separately in #1109 because this PR had already merged.

Performance Data

Measured with release-fast builds and the generated 80-turn mixed-visible historical-session fixture. Baseline is main at a824830a; after is this PR before merge.

Scenario Before After Delta / result
First open long session, latest content usable 619.0 ms 419.4 ms -199.6 ms (-32.2%)
First open long session, post-hydrate usable 3635.4 ms 3441.2 ms -194.2 ms (-5.3%)
Warm reopen long session, latest content usable 351.5 ms 200.6 ms -150.9 ms (-42.9%)
Rapid switch A->B->C, target latest usable 1165.2 ms 735.9 ms -429.3 ms (-36.8%)
Latest-anchor failure count, first/warm open 1 / 1 0 / 0 Strict guard passes
Rapid-switch non-target content holds 4 0 Stale session content no longer remains visible after target open intent
Post-visible loading/blank/scroll-jump events 0 / 0 / 0 0 / 0 / 0 No regression captured

Startup was measured for visibility, but not claimed as solved by this PR because native window timing still shows environment variance.

Risk / Compatibility

  • Startup is not treated as solved by this PR; native window creation/maximize still needs separate investigation.
  • Remote session behavior is not intentionally changed by this PR.
  • New trace points are startup/session E2E diagnostics and startupTrace phases, not high-volume production info logs.

Validation

  • pnpm run desktop:build:release-fast
  • pnpm run e2e:test:perf:release-fast
  • BITFUN_E2E_PERF_POST_VISIBLE_INTERACTION=first-scroll pnpm run e2e:test:perf:release-fast
  • pnpm --dir src/web-ui run test:run src/flow_chat/components/modern/VirtualMessageList.layout.test.ts src/flow_chat/services/FlowChatManager.test.ts src/flow_chat/store/FlowChatStore.test.ts src/flow_chat/services/openBtwSession.test.ts src/flow_chat/components/modern/ModernFlowChatContainer.history-state.test.tsx
  • pnpm run type-check:web
  • pnpm run check:repo-hygiene
  • cargo check -p bitfun-desktop
  • git diff --check gcwing/main...HEAD

@limityan limityan merged commit b34a970 into GCWing:main Jun 8, 2026
4 checks passed
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