Skip to content

Speed up latest site creation with a generated SQLite template#3482

Open
chubes4 wants to merge 2 commits into
trunkfrom
studio-create-site-sqlite-template
Open

Speed up latest site creation with a generated SQLite template#3482
chubes4 wants to merge 2 commits into
trunkfrom
studio-create-site-sqlite-template

Conversation

@chubes4
Copy link
Copy Markdown
Contributor

@chubes4 chubes4 commented May 14, 2026

Summary

  • Generate a preinstalled SQLite database template from the bundled latest WordPress files during the CLI package flow.
  • Use that template only for default latest site creation that starts immediately, falling back to the existing install path for missing templates, explicit WordPress versions, and --no-start.
  • Validate the generated template before packaging so stale DB schemas fail early instead of shipping an upgrade-screen redirect.

Evidence

Check Result
Default create-to-running 11252ms -> 6608ms (-4644ms, -41.3%)
Blueprint create-to-running 9519ms -> 8199ms (-1320ms)
Homeboy matrix assertions 46 passed, 0 failed
Missing template fallback Passed locally
Explicit WP version fallback --wp 6.8 created/started and reported 6.8.5
--no-start safety Passed locally; no template DB is copied
Locale customization sv produced WPLANG=sv_SE

Supporting rig PR: chubes4/homeboy-rigs#134

Studio issue: #3319

The same SQLite-template idea was also tested against Playground Web startup. It did not materially improve visible startup there (-1.34% for WP 6.8 and -5.61% for WP 6.4 in local traces), so this PR keeps the optimization Studio-owned and scoped to Studio's default latest create/start path.

Validation

  • npm test -- apps/cli/commands/site/tests/create.test.ts
  • npx eslint apps/cli/commands/site/create.ts apps/cli/commands/site/tests/create.test.ts scripts/generate-preinstalled-sqlite-template.ts
  • npm run typecheck
  • npm run cli:build && npm run cli:generate-preinstalled-sqlite-template
  • homeboy trace using the Studio SQLite template comparison rig from Add Studio SQLite template comparison trace chubes4/homeboy-rigs#134

Note: npm -w wp-studio run package also passed locally and generated/validated the template. That command mutates the local dependency layout as part of existing install:bundle behavior, so I restored the workspace with npm install before running final typecheck.

AI assistance

  • AI assistance: Yes
  • Tool(s): OpenCode (GPT-5.5)
  • Used for: Drafting the implementation and generator script, building the Homeboy evidence rig, running validation commands, and preparing the evidence summary. Chris directed the investigation and reviewed the conclusions.

@wpmobilebot
Copy link
Copy Markdown
Collaborator

wpmobilebot commented May 14, 2026

📊 Performance Test Results

Comparing dfefdd6 vs trunk

app-size

Metric trunk dfefdd6 Diff Change
App Size (Mac) 1409.62 MB 1410.00 MB +0.38 MB ⚪ 0.0%

site-editor

Metric trunk dfefdd6 Diff Change
load 1486 ms 1497 ms +11 ms ⚪ 0.0%

site-startup

Metric trunk dfefdd6 Diff Change
siteCreation 8587 ms 7570 ms 1017 ms 🟢 -11.8%
siteStartup 4923 ms 4923 ms 0 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@chubes4 chubes4 requested a review from wojtekn May 14, 2026 14:01
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.

2 participants