Skip to content

perf(compile): reuse the previous compile when no input changed - #951

Merged
kvlonge merged 2 commits into
mainfrom
perf/compile-reuse-unchanged
Oct 5, 2026
Merged

kvlonge merged 2 commits into
mainfrom
perf/compile-reuse-unchanged

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Why

A warm sqb compile with nothing changed still rediscovered, re-rendered and re-checked every model: about 8 s on a dense 3k project and 27 s at 10k. Checking that no input changed takes milliseconds (CHI-498, stage 1 of CHI-482).

Changes

  • When no input changed, sqb compile replays the previous stdout (identical apart from compile_timings) and exit code, including failed compiles, and prints one stderr line.
  • Inputs: project files (stat stamps with content-hash fallback), flags, selectors, --vars, target, cwd, SQLBUILD_*/SQB_* and template-read env vars, provider settings env vars, env files and secrets, Python, SQLBuild and native build identity, and loaded modules. target/compiled must match what this compile wrote.
  • Full compile for --no-cache, --manifest, --debug, profiling, compile_cache = false, run.id, and SQLBUILD_DISABLE_COMPILE_REUSE=1. Docs list inputs and limits.

Verification

  • No-change compile (fresh process): dense 3k 8.3 → 0.58 s, dense 10k 27 → ~1.5 s; cold and edit within noise.
  • Real-CLI oracle per input kind (equal to --no-cache, miss exactly when it should), provider-settings, concurrent-writer, corruption and store-failure tests; compile and build E2E run once with reuse enabled.
  • One independent review plus follow-up; make test, make check-ci.

Replay the stored report, diagnostics, and exit code when the project files, invocation, tracked environment, runtime, and written artifacts all match the previous compile. Misses, bypasses, and damaged entries fall back to a full compile.
@kvlonge
kvlonge enabled auto-merge (squash) October 5, 2026 17:10
@kvlonge
kvlonge merged commit 0b86fac into main Oct 5, 2026
32 checks passed
@kvlonge
kvlonge deleted the perf/compile-reuse-unchanged branch October 5, 2026 17:32
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