-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Make dogfood tests run in release
mode
#10576
Conversation
r? @Alexendoo (rustbot has picked a reviewer for you, use r? to override) |
How long does |
I wouldn't expect this to have such a large effect on the times since cargo dev dogfood
touch clippy_lints/src/lib.rs
time cargo dev dogfood
cargo dev-r dogfood
touch clippy_lints/src/lib.rs
time cargo dev-r dogfood Gives me ~40s for both |
OutdatedNote: dogfood doesn't do anything when you run the command twice without changing anything. Maybe that's where the improvement is coming from. I ran
Patch: diff --git a/clippy_dev/src/dogfood.rs b/clippy_dev/src/dogfood.rs
index b69e9f649ec..35653c76cc9 100644
--- a/clippy_dev/src/dogfood.rs
+++ b/clippy_dev/src/dogfood.rs
@@ -12,6 +12,10 @@ pub fn dogfood(fix: bool, allow_dirty: bool, allow_staged: bool) {
.args(["--features", "internal"])
.args(["--", "dogfood_clippy"]);
+ if !cfg!(debug_assertions) {
+ cmd.arg("--release");
+ }
+
let mut dogfood_args = Vec::new();
if fix {
dogfood_args.push("--fix"); Another experiment: When I already ran
So I think the best thing to do here would be: diff --git a/clippy_dev/src/dogfood.rs b/clippy_dev/src/dogfood.rs
index b69e9f649ec..484e0d4e88b 100644
--- a/clippy_dev/src/dogfood.rs
+++ b/clippy_dev/src/dogfood.rs
@@ -10,7 +10,8 @@ pub fn dogfood(fix: bool, allow_dirty: bool, allow_staged: bool) {
cmd.current_dir(clippy_project_root())
.args(["test", "--test", "dogfood"])
.args(["--features", "internal"])
- .args(["--", "dogfood_clippy"]);
+ .args(["--", "dogfood_clippy"])
+ .arg("--release");
let mut dogfood_args = Vec::new();
if fix { and NOT introduce |
OutdatedI just tested again with a clean slate of a recently pulled `master`. It is ~2 seconds faster. The first testing environment was in a mid-debugging branch, so dogfood was failing faster, that's why I found it so useful.In a "stable" and after I just saw flip1955's latest comment; going to test it. |
You can either open a new PR or redo this one. Up to you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would approve, but since this is my own patch, I don't want to approve my own thing.
Please update the PR description+title before this gets merged though |
That cuts the runtime down by not running it :P
That doesn't get shown by |
This is probably not worth it. Running dogfood in release mode would mean compiling clippy in release mode, which basically negates all the speed gains from running clippy on itself faster. Basically more than double the compilation time for release mode and dogfood now has to run in zero time. It also means getting an ICE while running dogfood will be much less pleasant experience. |
It seems like it doesn't (only compiling Clippy): dev: On the topic of the unrecognized option, moving - cargo test --test dogfood --features internal -- dogfood_clippy --release
+ cargo test --test dogfood --release --features internal -- dogfood_clippy |
Just tested on my machine:
Both tests were don first by running the command, then changing I'll run some more tests later to try different scenarios. |
More perf tests on windows: For debug mode with incremental:
Time: 3:13
Time: 2:25 For debug mode without incremental:
Time: 2:41 For release mode:
Time: 3:02 Release mode is only beating incremental debug mode when none of the incremental cache seems to get used. |
This differences maybe are caused by platform differences? These are my times (Using the same commands):
Difference from Linux Difference from Linux So this PR makes sense only for Linux users. Note that, a "mid-debugging" scenario (adding a new line to |
If someone could verify the results on their machine. Maybe test them on Mac OS? |
That's not the outcome we want. I should have checked for that 😅 In that case, compiling Clippy in release mode and running dogfood in release mode vs both in debug mode took about the same time for me. So I don't think this improves things significantly. Also since it is really machine dependent as it seems, I don't think adding a new alias for it is worth it. |
On mine, with cargo clean
time cargo test --test dogfood --features internal
touch clippy_lints/src/lib.rs
time cargo test --test dogfood --features internal
cargo clean
time cargo test --test dogfood --features internal --release
touch clippy_lints/src/lib.rs
time cargo test --test dogfood --features internal --release
|
With this patch, same commands as #10576 (comment)
So I would conclude that this PR doesn't improve the situation. EDIT: I use Arch Linux btw
|
So Alexendoo's differences are:
So Alexendoo's machine also performes worse, even on Linux. (Please react if you agree or disagree) |
Thanks for investigating this! |
Build quine-mc_cluskey with `opt-level=3` in dev builds While doing some profiling I noticed that debug clippy running on the `clippy_lints` crate spends 35s out of 160s in one specific code path of `nonminimal_bool`, which seemed a bit excessive. I've found that just enabling optimizations for quine-mc_cluskey (used by nonminimal_bool) cuts down the part that took 35s to 3s While this doesn't really change anything for users, this helps dogfood a bit as it cuts off about half a minute of runtime (in some of my tests, at least). Something similar was attempted in #10576, however that involved compiling everything in release mode including clippy itself, whereas this only affects a single dependency that's compiled in parallel with something that takes longer so this should hopefully not have a negative impact in any case (and changing clippy doesn't require recompiling that dependency) changelog: none
The old PR was about creating a new alias in
.cargo/config.toml
. After some extra testing we noticed that the speedup wasn't that critical and @flip1995 created a new patch to actually makedogfood
tests run with a--release
argument.Ignore any conversation before this comment, as the PR has been re-done.
changelog:none