Skip to content

perf(ci): optimize DuckDB test execution and eliminate redundant builds - #1066

Merged
athvin merged 5 commits into
mainfrom
perf/backend-ci-profile
Nov 9, 2026
Merged

athvin merged 5 commits into
mainfrom
perf/backend-ci-profile

Conversation

@athvin

@athvin athvin commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Closes #1065

What

Optimize bundled DuckDB for dev/tests and execute extension checks from the already-built integration binary. Add an opt-in comparison of the standard free x86-64 and ARM64 GitHub runners.

Why

Full backend CI took 8m11–8m33. Its slowest tests executed an unoptimized database engine; the separate extension invocation also rebuilt a different Cargo feature graph for about 65 seconds.

Proof

make check, make check-e2e, the real selected-package/extension runner, 46 CI helper tests, skills drift checks, workflow-shell checks and actionlint passed locally before pushing. The same 52 lake tests passed in 343.506 → 76.350 seconds locally. The first complete hosted gate passed in 4m42s (run 42706135674), versus 8m11–8m33 and a fresh 8m56s base run. make check passed again after refreshing onto 0a208d9c; all four real Postgres storage trials passed, with no repeatable tmpfs improvement.

Risk & rollback

Cold optimized native compilation costs more; PR credentials remain read-only. Product Rust assertions, overflow checks and all existing test coverage remain intact. Revert the merge commit to restore the former profile and workflow.

Post-merge ledger

Closed by: Codex · session Codex:01a1bef1-8627-7c21-8a86-6c4743d8906f on Mac-46 · 2026-11-09T23:22:21Z

Specific to this change

  • Hosted full backend: PR runs 42706135674 / 42708615045 took 4m42s / 4m57s; main took 4m56s. Original baseline 8m11–8m33; fresh base run 42706398325 took 8m56s. Native C/C++ cache hits were 100% in measured PR jobs.
  • Free-runner comparison completed: 42718540424, all six jobs passed first attempt on 50de124e. Each had 1,061 identical attributed results, identical compiler/version and coverage digest, zero warm Rust/native misses and zero cache errors. x86 samples 131.557 / 131.230 / 142.074s, median 131.557s; ARM 118.782 / 114.897 / 115.751s, median 115.751s (12.01% faster for this selected-package build/test gate). This falls below the predeclared 15% migration threshold and is not a full-backend ARM result; retain existing free x86 runners. x86 priming also reused every Rust/native object from normal CI; ARM priming populated previously missing Rust objects. Do not compare unlike priming cache states as a hardware benchmark.
  • Archive comparison 42713537379: all 45 jobs passed and test identities matched. Median existing builds 178s versus producer + archive consumers 202s (13.48% slower); retain separate cached builds. Five paired results: 172/202, 187/221, 169/207, 178/188, 180/178 seconds.
Context — investigation and measurements

The committed backend-ci-profile.md reference records the method, baseline jobs, CPU profiling, alternatives and coverage decisions. Raw paired timings, Samply captures with symbols and interactive flame graphs are retained locally under /tmp/er-backend-profile-evidence.

The slow incremental/full-equivalence test had a three-run median of 66.441 seconds at native level 0 and 11.294 at level 3. Levels 1–3 performed similarly; level 3 matches the native flags already cached by nightly benchmarks. Our Rust code remains unoptimized with assertions and overflow checks. Release builds already optimized DuckDB; this is not a claim of faster production queries.

The extension runner checks the exact Cargo package/target artifact, requires the community-extension test to exist, propagates failures and scopes the enabling environment to that binary. The full local rest-suite output contained 1,042 attributed results; metadata discovery rebuilt nothing.

The manual main-only hardware experiment uses three machines per architecture. Each primes the protected native cache, then times the real gate from an empty target. It rejects native cache misses/errors, changed or incompletely parsed test identities, and local/self-hosted target cleanup. All ARM tool archives were hash-verified and their executables tested in local Ubuntu ARM64 before publication. Normal required CI remains on its existing architecture until a complete comparison justifies changing it.

@athvin
athvin force-pushed the perf/backend-ci-profile branch from 71f01a1 to 71cb224 Compare November 9, 2026 22:05
@athvin
athvin merged commit 80c674e into main Nov 9, 2026
47 checks passed
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.

Reduce full backend CI latency without dropping correctness coverage

2 participants