-
Notifications
You must be signed in to change notification settings - Fork 14.1k
handle --release flag separately for tools
#136048
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
handle --release flag separately for tools
#136048
Conversation
Signed-off-by: onur-ozkan <[email protected]>
Signed-off-by: onur-ozkan <[email protected]>
Signed-off-by: onur-ozkan <[email protected]>
Signed-off-by: onur-ozkan <[email protected]>
--release flag separately for tools --release flag separately for tools
|
rustbot has assigned @Mark-Simulacrum. Use |
|
This PR modifies If appropriate, please update |
Signed-off-by: onur-ozkan <[email protected]>
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.
Good idea, we definitely don't need every tool to be optimized, especially the bootstrap tools. Although there might be some tools for which it can be helpful, e.g. compiletest - have you benchmarked how long does it take to run e.g. x test tests/ui with a non-optimized compiletest?
Regarding saving compilation time, removing debuginfo could also help a lot, since it will be now generated by default when release mode is no longer used. This can also increase the size of the build directory quite a lot.
I'm a bit confused by the implementation though. Why didn't you use a separate config option for this, to let people configure it in config.toml (e.g. optimize-tools)? The current behavior seems confusing to me - setting rust.optimize = true only optimizes the compiler and stdlib, using --release optimizes everything. If people want optimized tools, they would need to keep passing --release to every x invocation, which is annoying. Automatically enabling the flag on CI during config parsing is also quite opaque.
We could add rust.optimize-tools, set it to false by default, to make local builds faster, and then set it to true in the dist profile, to restore the previous behavior on CI.
|
I'll unassign myself, but in general I'd love to see some numbers on relative gain here. For tidy, at least, this seems to be a net loss -- local measurements with ~1 iteration suggest this is a ~7 second win on compilation time but a 18.5 second regression on pre-compiled, clean work trees and a 12 second regression on from-scratch builds end-to-end. Tidy might be special - some other tools likely would benefit more - but it's not obvious to me that we have a ton of tools that are both built often and fall in a bucket of "not worth optimizing". And if they're built rarely, then maybe extra configuration and a CLI flag is just not worth it for them. We could also customize what release means via Cargo.toml workspace overrides on a per-package basis. That could give a better balancing point. Some numbers for my local setup on time ./x.py test src/tools/tidy: Release (current):
W/o --release:
|
|
Since you already did some investigation, r? @Mark-Simulacrum |
I don't think there will be any difference when we propagate another config option rather than propagating a command argument. We still need to use
That way they would need to change the option in config.toml if they want to disable the
That wouldn't be good for tools like I will do more benchmarking (I only tested |
|
@rustbot author |
The default would be unoptimized tools, so they wouldn't have to change config.toml to get that behavior. Although I'm not sure if that default will work for people, optimized tools have been the default so far, and I suspect that some of them will have to stay optimized, or performance will be bad). In that case, users would need to pass I guess that I don't see why "optimizing tools" is such a special use-case that it would have to be overridden through the CLI, and it wouldn't be possible to be configured through config.toml. Most other CLI flags can be configured through config.toml. |
|
Here are some time reports from various bootstrap commands (each called on fresh state after
Apparently it doesn't seem worth (like bootstrap) to do this on most cases. I assume building debug |
…e, r=Kobzol override build profile for bootstrap tests Using the release profile for bootstrap self tests puts too much load on the CPU and makes it quite hot on `x test bootstrap` invocation for no good reason. It also makes the compilation take longer than usual (see rust-lang#136048 (comment)). This change turns off the release flag for bootstrap self tests.
Rollup merge of rust-lang#136157 - onur-ozkan:override-release-profile, r=Kobzol override build profile for bootstrap tests Using the release profile for bootstrap self tests puts too much load on the CPU and makes it quite hot on `x test bootstrap` invocation for no good reason. It also makes the compilation take longer than usual (see rust-lang#136048 (comment)). This change turns off the release flag for bootstrap self tests.
override build profile for bootstrap tests Using the release profile for bootstrap self tests puts too much load on the CPU and makes it quite hot on `x test bootstrap` invocation for no good reason. It also makes the compilation take longer than usual (see rust-lang/rust#136048 (comment)). This change turns off the release flag for bootstrap self tests.
Right now, we are using the
--releaseflag on everything based on therust.optimizeoption, which istrueby default (see the reasons). But the reasons for this are only relevant to the compiler and the standard library, so it doesn't make sense to use--releasefor every build.This PR adds
--releaseflag (similar to cargo) and separates--releasehandling between compiler/std and tool builds. This saves a lot of time when building or testing compiler tools (e.g.,x test bootstrapwithout release build saves ~10 seconds on Ryzen 9 9950X).