Skip to content

ci: cache rust dependencies, enable parallelism (1.9x to 5.5x faster)#5236

Merged
wjones127 merged 7 commits intolance-format:mainfrom
wjones127:ci/cache-dependencies-rust
Nov 14, 2025
Merged

ci: cache rust dependencies, enable parallelism (1.9x to 5.5x faster)#5236
wjones127 merged 7 commits intolance-format:mainfrom
wjones127:ci/cache-dependencies-rust

Conversation

@wjones127
Copy link
Copy Markdown
Contributor

@wjones127 wjones127 commented Nov 13, 2025

In #4139, we stopped caching built dependencies. Since then, we've had to wait 20 minutes for the test to build, before we even run any tests.

This PR re-enables the build cache and implements a different mitigation to avoid large caches: we disable debug info in dependencies and only keep it in our crates. This is inspired by DataFusion's CI: https://github.com/apache/datafusion/blob/377c0fce481d561d58e3a6fad2dca18cb1d58384/Cargo.toml#L247-L259

Below are the reductions in size of the target directory. Previously, Rust jobs were running with debuginfo=1, so the target directory was about 16GB. With these changes, it's down to 7.6GB. If we decided later we wanted it even smaller, we could enable -C opt-level=s, which gets us down to 2.1GB.

Profile Flags target/ size % reduction
dev 25.0GB -
dev -C debuginfo=1 16.0GB 36%
dev -C debuginfo=line-tables-only 12.0GB 52%
ci 7.6GB 70%
ci -C opt-level=s 2.1GB 92%

Other optimizations added:

  • Removed CARGO_BUILD_JOBS, which was preventing parallelism in builds. We can add this back to specific runners if we find it's necessary. This will speed up cold builds.
  • Align profile across all builds in CI.

Thanks to reduction in disk space, closes #5218.

Performance improvement

Most of the speed improvement probably comes from removing CARGO_BUILD_JOBS. Jobs that run tests aren't much faster since the tests take a while.

Case Before After (cold) mul After (cached) mul
linux-arm 38m 58s 20m 5s 1.9x 18m 33s 2.1x
MSRV Check 11m 46s 5m 17s 2.3x 2m 8s 5.5x
Clippy 13m 16s 5m 26s 2.4x 2m 25s 5.4x

@github-actions github-actions Bot added the ci Github Action or Test issues label Nov 13, 2025
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Nov 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.23%. Comparing base (7c19c22) to head (f68c5d1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5236      +/-   ##
==========================================
- Coverage   82.23%   82.23%   -0.01%     
==========================================
  Files         344      344              
  Lines      144765   144765              
  Branches   144765   144765              
==========================================
- Hits       119050   119048       -2     
  Misses      21797    21797              
- Partials     3918     3920       +2     
Flag Coverage Δ
unittests 82.23% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wjones127 wjones127 changed the title ci: cache rust dependencies ci: cache rust dependencies (1.9x to 5.5x faster) Nov 13, 2025
@wjones127 wjones127 marked this pull request as ready for review November 13, 2025 21:36
@wjones127 wjones127 requested a review from Xuanwo November 13, 2025 21:36
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 113 to +115
- uses: ./.github/workflows/build_linux_wheel
with:
args: "--profile ci"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Pass required python-minor-version to build wheel actions

.github/workflows/build_linux_wheel declares inputs.python-minor-version as required. After this change the linux test job (lines 113‑115) invokes the action without that input, and the same omission occurs in the linux-arm (lines 184‑188), windows (lines 238‑240), and aws-integtest (lines 262‑264) jobs. GitHub Actions aborts a composite action when a required input is missing (Input required and not supplied: python-minor-version), so all of these jobs now fail before any wheels are built. Please continue passing the matrix’ python minor version (or a fixed value) to every invocation.

Useful? React with 👍 / 👎.

@wjones127 wjones127 changed the title ci: cache rust dependencies (1.9x to 5.5x faster) ci: cache rust dependencies, enable parallelism (1.9x to 5.5x faster) Nov 13, 2025
Copy link
Copy Markdown
Collaborator

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@wjones127 wjones127 force-pushed the ci/cache-dependencies-rust branch from fa43c1e to f68c5d1 Compare November 14, 2025 16:30
@wjones127 wjones127 merged commit f48bbd9 into lance-format:main Nov 14, 2025
25 checks passed
@wjones127 wjones127 deleted the ci/cache-dependencies-rust branch November 14, 2025 17:56
wjones127 added a commit to lancedb/lancedb that referenced this pull request Nov 18, 2025
* Add `ci` profile for smaller build caches. This had a meaningful
impact in Lance, and I expect a similar impact here.
lance-format/lance#5236
* Get caching working in Rust. Previously was not working due to
`workspaces: rust`.
* Get caching working in NodeJs lint job. Previously wasn't working
because we installed the toolchain **after** we called `- uses:
Swatinem/rust-cache@v2`, which invalidates the cache locally.
* Fix broken pytest from async io transition
(`pytest.PytestRemovedIn9Warning`)
* Altered `get_num_sub_vectors` to handle bug in case of 4-bit PQ. This
was cause of `rust future panicked: unknown error`. Raised an issue
upstream to change panic to error:
lance-format/lance#5257
* Call `npm run docs` to fix doc issue.
* Disable flakey Windows test for consistency. It's just an OS-specific
timer issue, not our fault.
* Fix Windows absolute path handling in namespaces. Was causing CI
failure `OSError: [WinError 123] The filename, directory name, or volume
label syntax is incorrect: `
jackye1995 pushed a commit to jackye1995/lance that referenced this pull request Jan 21, 2026
…lance-format#5236)

In lance-format#4139, we stopped caching built dependencies. Since then, we've had
to wait 20 minutes for the test to build, before we even run any tests.

This PR re-enables the build cache and implements a different mitigation
to avoid large caches: we disable debug info in dependencies and only
keep it in our crates. This is inspired by DataFusion's CI:
https://github.com/apache/datafusion/blob/377c0fce481d561d58e3a6fad2dca18cb1d58384/Cargo.toml#L247-L259

Below are the reductions in size of the target directory. Previously,
Rust jobs were running with `debuginfo=1`, so the target directory was
about 16GB. With these changes, it's down to 7.6GB. If we decided later
we wanted it even smaller, we could enable `-C opt-level=s`, which gets
us down to 2.1GB.

| Profile | Flags | `target/` size | % reduction |
|--------|--------|-------:|------:|
| dev |  | 25.0GB | - |
| dev | `-C debuginfo=1` | 16.0GB | 36% |
| dev | `-C debuginfo=line-tables-only` | 12.0GB | 52% | 
| ci | | 7.6GB | 70% | 
| ci | `-C opt-level=s` | 2.1GB | 92% |

Other optimizations added:

* Removed `CARGO_BUILD_JOBS`, which was preventing parallelism in
builds. We can add this back to specific runners if we find it's
necessary. This will speed up cold builds.
* Align profile across all builds in CI.

Thanks to reduction in disk space, closes lance-format#5218.

### Performance improvement

Most of the speed improvement probably comes from removing
`CARGO_BUILD_JOBS`. Jobs that run tests aren't much faster since the
tests take a while.

| Case | Before | After (cold) | mul | After (cached) | mul |
|--------|-------:|---:|---:|---:|---:|
| linux-arm | 38m 58s |  20m 5s | **1.9x** | 18m 33s | **2.1x** |
| MSRV Check | 11m 46s | 5m 17s | **2.3x** | 2m 8s | **5.5x** |
| Clippy | 13m 16s | 5m 26s | **2.4x** | 2m 25s | **5.4x** |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Github Action or Test issues java python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: CI failed for StorageIsFull in take_blobs related tests

3 participants