Skip to content

perf(startup): add release timing harness#966

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/startup-session-perf-followup
May 30, 2026
Merged

perf(startup): add release timing harness#966
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/startup-session-perf-followup

Conversation

@limityan
Copy link
Copy Markdown
Collaborator

@limityan limityan commented May 30, 2026

Summary

  • Add a sanitized startup/session performance trace snapshot for debug and explicit perf E2E runs.
  • Add a release-fast performance E2E path, a long-session fixture generator, and a startup/session timing spec.
  • Enable embedded WebDriver for release-fast E2E through the existing devtools feature and update WebDriver routes to Axum 0.8 path syntax.
  • Stabilize the startup splash background with a shared --bitfun-startup-bg variable so light-theme startup no longer flashes from a dark splash fallback to a white splash.

Refs #949

Performance Data

Scenario: Windows local release-fast build with production web bundle, release-fast Rust profile, embedded WebDriver, 80 generated session metadata rows, and one 80-turn long session with 160 synthetic tool results.

Latest post-rebase sample from this PR:

Scenario Metric Result
Startup first_script_eval 1358.4 ms
Startup before_render duration 32.7 ms
Startup app_effect_mounted 1484.0 ms
Startup main_window_shown 1484.6 ms
Startup non_critical_init_done 1886.8 ms
Startup interactive_shell_ready 1943.5 ms
Long session first open initially loaded turns 3 / 80
Long session first open restore latest turns 39.4 ms
Long session first open state commit 2.5 ms
Long session first open latest-turn first frame 48.9 ms
Long session background hydrate full hydrate 56.5 ms

Startup API aggregate in the same sample:

Command Count Total Max
get_config 10 1438.7 ms 357.5 ms
initialize_ai 1 335.9 ms 335.9 ms
git_is_repository 4 73.3 ms 28.7 ms
remote_get_workspace_info 1 69.5 ms 69.5 ms
git_get_repository_basic 3 51.8 ms 17.8 ms

Earlier repeat samples on the same release-fast branch before the final upstream rebase showed startup variance rather than a stable startup reduction:

Scenario Metric Min P50 Max
Startup, 3 runs interactive_shell_ready 1438.1 ms 1554.0 ms 1597.2 ms
Startup, 3 runs main_window_shown 1066.2 ms 1098.9 ms 1188.7 ms
Long session, 3 runs latest-turn first frame 36.0 ms 49.5 ms 64.5 ms

One earlier cold-ish long-session background hydrate outlier hit about 1535.9 ms; backend logs attributed it to reading 80 turn files with about 1.9 MB raw tool-result text. The perceived first frame still stayed near the 50 ms range because only the latest 3 turns are restored initially.

This PR should be evaluated as measurement infrastructure plus startup visual consistency. It does not claim an end-to-end startup reduction; the data points to follow-up optimization work around startup API duplication and early initialization.

Risks / Notes

  • The diagnostic window.__BITFUN_STARTUP_TRACE__ surface exposes only sanitized phase/API aggregates, not raw request payloads or workspace paths, and is limited to dev or explicit perf WebDriver runs.
  • devtools now enables embedded WebDriver for release-fast E2E. End-user release builds are unaffected unless that feature is explicitly enabled.
  • Session nav data-testid attributes are test-only selectors; data-session-title mirrors already visible UI text.
  • The long-session fixture writes synthetic local test data and requires an explicit workspace path when run.
  • Startup splash background is now tied to the earliest known theme background; if a platform shows a native pre-document blank window before web content, that remains a separate native show-timing problem.

Verification

  • pnpm run type-check:web
  • pnpm --dir src/web-ui run test:run src/shared/utils/startupTrace.test.ts src/infrastructure/theme/core/ThemeService.test.ts
  • pnpm run check:repo-hygiene
  • cargo check -p bitfun-desktop --features devtools (passes with existing parse_clipboard_path_segments unused warning)
  • pnpm run desktop:build:release-fast (passes with existing Vite chunk warnings and the same Rust warning)
  • E2E_TEST_WORKSPACE=<workspace> BITFUN_E2E_PERF_SESSION_ID=perf-long-session-000 pnpm run e2e:test:perf:release-fast
  • git diff --check gcwing/main...HEAD

@limityan limityan merged commit 5468f2f into GCWing:main May 30, 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