Skip to content

perf(compile): stop compile importing every command model - #945

Merged
kvlonge merged 1 commit into
mainfrom
perf/warm-overhead-0134
Oct 4, 2026
Merged

kvlonge merged 1 commit into
mainfrom
perf/warm-overhead-0134

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Why

Since #941, every command, including compile, imported the request and result models of every other command through the warehouse-group helpers: 84 extra modules and about 0.25 s of CPU per process before compiling starts. On a ~1,400-model project, warm and one-model-edit compiles got about 3% slower from 0.133.6 to 0.134.0.

Changes

  • Move CommandWarehouseScope, AuthoredTargetWarehouse and ResolvedWarehouse to sqlbuild.cli.entry.models, which compile already loads, and update their imports.
  • Add an import-footprint test: a fresh-interpreter DuckDB compile --json must not load the build, run or command models.

Verification

  • Same machine, alternating runs, CPU: warm 7.21 → 6.98 s and edit 7.85 → 7.62 s (0.133.6: 6.96 / 7.61 s). Import count 1,477 → 1,392.
  • The new test fails without the move. One independent review; make test, make check-ci.

Command-group warehouse selection imported its three small dataclasses from
the CLI command models module, which pulls in every command's request and
result models. Every command, including warm compiles, paid that import.
Move the warehouse scope models beside the CLI entry models and guard the
compile import footprint with a fresh-process test.
@kvlonge
kvlonge enabled auto-merge (squash) October 4, 2026 15:05
@kvlonge
kvlonge merged commit 86ab18a into main Oct 4, 2026
22 checks passed
@kvlonge
kvlonge deleted the perf/warm-overhead-0134 branch October 4, 2026 15:33
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