Skip to content

perf: speed up app initialization and add startup timing telemetry (THU-595)#984

Merged
ital0 merged 6 commits into
mainfrom
italomenezes/thu-595-investigate-app-initialization-time
Jun 15, 2026
Merged

perf: speed up app initialization and add startup timing telemetry (THU-595)#984
ital0 merged 6 commits into
mainfrom
italomenezes/thu-595-investigate-app-initialization-time

Conversation

@ital0

@ital0 ital0 commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Note

Medium Risk
Touches core boot path (DB init, sync gate, defaults reconciliation) and changes how PowerSync is imported at startup; failures are mostly telemetry or best-effort sync, but regressions could affect time-to-interactive or sync readiness.

Overview
Adds startup performance telemetry (app_init_timing after init completes, app_chat_ready on first chat hydration) via a lightweight init-timing module that records bundle eval, first mount, per-step durations, sync gate outcome, and total time.

Init pipeline changes overlap config fetch with later steps, add a first select 1 step to absorb PowerSync’s deferred DB ready work, time data migrations, run tray and PostHog init in parallel, and report initial_sync_outcome (disabled / synced / timed_out / failed) from waitForInitialSync.

Bundle-size work moves sync helpers into SDK-free sync-state.ts (entry code imports that path instead of the PowerSync barrel), plus Vite treeshake/alias tweaks so more @powersync/common stays in the lazy PowerSync chunk.

Boot DB work batches default reconciliation lookups and reduces redundant queries in removed-default cleanup.

Reviewed by Cursor Bugbot for commit de568bf. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

Copy link
Copy Markdown

Semgrep Security Scan

No security issues found.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit dc0a5ea. Configure here.

Comment thread src/hooks/use-app-initialization.ts
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

Preview environment destroyed 🧹

Stack preview-pr-984 and its Cloudflare subdomain have been cleaned up.

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

PR Metrics

Metric Value
Lines changed (prod code) +431 / -187
JS bundle size (gzipped) 🟢 737.6 KB → 682.1 KB (-55.5 KB, -7.5%)
Test coverage 🟢 78.13% → 78.09% (+-0.0%)
Performance (preview) Preview not ready — Render deploy may have timed out
Accessibility
Best Practices
SEO

Updated Mon, 15 Jun 2026 15:53:49 GMT · run #1885

@ital0 ital0 self-assigned this Jun 12, 2026
darkbanjo
darkbanjo previously approved these changes Jun 15, 2026
@ital0 ital0 force-pushed the italomenezes/thu-595-investigate-app-initialization-time branch from def6e7d to de568bf Compare June 15, 2026 15:47
@ital0 ital0 merged commit 631f360 into main Jun 15, 2026
34 of 37 checks passed
@ital0 ital0 deleted the italomenezes/thu-595-investigate-app-initialization-time branch June 15, 2026 17:59
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.

3 participants