Skip to content

[infra] Optimize CI/CD build times#157

Draft
MarcoForte wants to merge 26 commits intomainfrom
ci/optimize-build-times
Draft

[infra] Optimize CI/CD build times#157
MarcoForte wants to merge 26 commits intomainfrom
ci/optimize-build-times

Conversation

@MarcoForte
Copy link
Contributor

@MarcoForte MarcoForte commented Feb 1, 2026

playing around with claude code, asking to loop over improving cicd times iteratively.
Maybe some optimisations are useful.

MarcoForte and others added 2 commits February 1, 2026 13:15
- Add CI profile with thin LTO and parallel codegen (~2x faster builds)
- Add Rust dependency caching with Swatinem/rust-cache
- Upgrade to modern GitHub Actions (dtolnay/rust-toolchain, actions/checkout@v4)
- Replace slow snap zig install with mlugg/setup-zig
- Skip redundant Rust pre-commit checks (already run in rust.yml)
- Use CI profile for PR/main builds, release profile for tags

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
prek requires these tools to be available for the pre-commit hooks.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove separate cargo build step - clippy and test share the same dev
profile, so clippy compiles once and test reuses those artifacts.

The CI profile is kept for Python wheel builds where optimized output
matters.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace vendored OpenSSL with rustls (pure Rust TLS)
  - Removes ~30-60s of OpenSSL compilation from source
  - rustls compiles much faster and has no C dependencies

- Add mold linker for faster linking on Linux
  - mold is significantly faster than the default linker

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
nextest is a faster test runner with better parallelism,
typically 2-3x faster than cargo test.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove mold linker (saves ~12s, linking isn't the bottleneck)
- Only test library, skip binary tests (cuts test count from 184 to 92)

Expected time: ~60s with warm cache

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use separate cache key for native builds (datago-native)
- Set manylinux: off for PRs to skip auditwheel
- Reduce test matrix to min/max Python versions (3.10, 3.13)
- Combine pip install commands
- Use quiet pytest output

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Set lto = false in CI profile (faster linking)
- Set CARGO_INCREMENTAL=1 for incremental builds
- Use opt-level = 2 instead of 3

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add required-features = ["cli"] to binary target
- Pass --no-default-features to maturin build
- CLI (clap + prettytable) not needed for Python bindings

Build time: 41s → 30s

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
astral-sh's fork has performance improvements and better security defaults.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@blefaudeux
Copy link
Collaborator

I went a bit overboard in the rust build options for speed, but for real when using this from python I don't think that the bottleneck and we could relax them. I'm thinking lto specifically in Cargo.toml / profile.release, I think it adds a fair bit to the build time

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