-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cargo build
and cargo test
always expire each other build cache
#129820
Comments
This is not common. Something is changing about your build settings which is not obvious here. The usual cause of this is your editor running
which should contain some explanation about what is changing between builds that is causing the cache to be evicted. |
I'm using vscode with RA using seperated profile, so seems not editor extension problem. "rust-analyzer.cargo.extraArgs": [
"--profile",
"x-rust-analyzer"
], Currently, I workaround with Maybe debug what happen with |
Long story short:
I deleted old profile with cargo clean, nothing else changed. [profile.release]
debug = false
strip = true
opt-level = 3
lto = true
codegen-units = 1
panic = "abort"
[profile.x-reproduce]
inherits = "release"
Cannot reproduce build cache problem again. Before I delete old profile, I was able to 100% reproduce that multiple times. Speak of why I let RA use seperate profile, background problem is rust-lang/rust-analyzer#15057 "rust-analyzer.cargo.extraArgs": [
"--profile",
"x-rust-analyzer"
], Not sure why build cache problem happen again here. Maybe a rust build cache sometime drop into always happen bug? Maybe a sccache bug? I have no idea. |
cargo build
and cargo test
always expire each other build cache
Aside: I don't think it explains repeated from-scratch rebuilds, but |
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 againactual
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
expirecargo 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 test
should not expirecargo build
cache.cargo build
should not expirecargo test
cache.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.
The text was updated successfully, but these errors were encountered: