Skip to content

perf(docker): drop the useless CGO dep-prewarm line#656

Merged
benben merged 1 commit into
mainfrom
ben/drop-useless-prewarm
Jun 2, 2026
Merged

perf(docker): drop the useless CGO dep-prewarm line#656
benben merged 1 commit into
mainfrom
ben/drop-useless-prewarm

Conversation

@benben
Copy link
Copy Markdown
Member

@benben benben commented Jun 2, 2026

Why

The CGO dep-prewarm added in #654 was premised on a multi-minute CGO
compile of duckdb-go. That premise was wrong: duckdb-go-bindings
ships prebuilt static libs (libduckdb_*.a, libparquet_extension.a
… ~1.7GB in the module cache) — there is no DuckDB C++ compile to cache.
The other prewarmed dep, pg_query_go, cold-compiles in ~4s. So the
prewarm layer saved single-digit seconds while adding a confusing extra
step.

Measured on warm main builds after #654:

image before after #654 (warm)
main 288s 264s
controlplane 241s 229s

That ~10% came from the layer reordering (module + extension
downloads moved ahead of COPY . ., so they cache on source-only PRs),
not from the prewarm. The dominant remaining cost is the final CGO
link of the prebuilt static libs (~68s in the warm build's #18),
which caching can't touch — it changes with every source edit.

What

Remove the prewarm RUN from all three Dockerfiles. Keep:

Real lever (separate PR)

Build only linux/arm64 in PR CI (mw-dev is 29 arm64 / 2 amd64),
halving the worker matrix — that targets the link floor the prewarm
couldn't.

🤖 Generated with Claude Code

The prewarm added in #654 was premised on a multi-minute CGO compile of
duckdb-go. That premise was wrong: duckdb-go-bindings ships PREBUILT
static libs (libduckdb_*.a etc, ~1.7GB in the module cache) — there is
no DuckDB C++ compile to cache. The other prewarmed dep, pg_query_go,
cold-compiles in ~4s. So the prewarm layer saved single-digit seconds
while adding a confusing extra build step.

Measured on warm main builds after #654:
  main         288s -> 264s
  controlplane 241s -> 229s
The ~10% saving came from the LAYER REORDERING (module + extension
downloads moved ahead of COPY . ., so they cache on source-only PRs),
not from the prewarm. The dominant remaining cost is the final CGO
*link* of the prebuilt static libs (~68s), which caching can't touch
because it changes with every first-party source edit.

Remove the prewarm RUN from all three Dockerfiles. Keep the valuable
reordering and the worker pin-without-tidy fix from #655.

Net build-time wins still live here:
  - module download + extension fetch cached before COPY . .
Real PR-latency lever (separate change): build only linux/arm64 in PR
CI (mw-dev is arm64), halving the worker matrix.
@benben benben merged commit 00575bc into main Jun 2, 2026
22 checks passed
@benben benben deleted the ben/drop-useless-prewarm branch June 2, 2026 11:05
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