`cargo build` and `cargo test` always expire each other build cache
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
bug
very common scenario let build cache expired
version
1.80.0
edit
-
was able to always reproduce this, before I
cargo clean -
after
cargo clean, cannot reproduce this again
actual
N th build is expected.
$ cargo build --profile xxx && yarn workspaces foreach --all run postbuild
...
255.36s user 15.29s system 110% cpu 4:04.42 total
N+1 th build are also expected.
$ cargo build --profile xxx && yarn workspaces foreach --all run postbuild
...
15.90s user 1.18s system 100% cpu 16.910 total
$ cargo build --profile xxx && yarn workspaces foreach --all run postbuild
...
15.27s user 1.11s system 104% cpu 15.685 total
$ cargo build --profile xxx && yarn workspaces foreach --all run postbuild
...
15.65s user 1.07s system 104% cpu 16.081 total
BUT unexpectedly, cargo test seems expire all cache.
$ cargo test --profile xxx
...
391.13s user 24.45s system 114% cpu 6:04.12 total
Below cargo test are expected.
$ cargo test --profile xxx
...
0.66s user 0.39s system 16% cpu 6.182 total
$ cargo test --profile xxx
...
0.45s user 0.23s system 122% cpu 0.555 total
Unexpectedly, cargo build expire cargo test cache.
$ cargo build --profile xxx && yarn workspaces foreach --all run postbuild
...
247.31s user 15.54s system 110% cpu 3:58.70 total
$ cargo build --profile xxx && yarn workspaces foreach --all run postbuild
...
15.57s user 1.04s system 103% cpu 16.054 total
expected
-
cargo testshould not expirecargo buildcache. -
cargo buildshould not expirecargo testcache. -
should have rust docs on how to improve compile speed beside
sccache
additional
I always see compiling all the dep tree again and again and again and again and again.
- Are there any solution or workaround to pre compile all the libraries?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the alternating cargo build --profile xxx and cargo test --profile xxx commands, recording whether each command recompiles the dependency tree. Compare the build-cache behavior before and after cargo clean; done means repeated build and test runs reuse the expected artifacts without invalidating each other, with any documentation scope separately identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100