-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Introduce 'nice' value under cargo.toml -> [build] #9250
Comments
cc #9221 |
(i should note that jobs != absolute CPU usage, because of kernel scheduling and multi-threaded compilation and such, |
i'm looking for this exact functionality i've tried aliases and bash functions but i think cargo supporting it directly would be... nice 😄 i'm surprised more build tools haven't added support as it results in a much more responsive experience in browsers/apps/etc. while compiling |
You could also try |
pgray, "nice" is not part of a build tool, but outside. if you want nice experience, use "nice cargo ...". build tool does not need this complexity. in windoes this is not caled nice, but start /low or so. again nothing to do with cargo. a way to go might be to control number of jobs, as suggested in #12912. but personally i am fan of using nice - as long it does not cause out of memory killer to terminate my browser for example. |
IMO this would be more fitting for |
FWIW, OOM killed issue is tracked in #9157, as there might be other specific approaches for it. |
This is really important for lower-end systems that can get completely hung installing basic software. Case in point: I just spun up an If Cargo were running as a lower priority Linux process, I probably would not lose connectivity to my remote servers. |
Describe the problem you are trying to solve
Often enough I have cargo builds running in the background, and then I open up some entertainment while it finishes, but I often notice that my desktop is generally slow (no surprise, something is hammering the CPU in the background). I've began doing
nice -n 20 bash -c "cargo build"
(or something similar) recently, however, I still sometimes forget it and get frustrated to cancel the build and restart it with the (pretty verbose)nice
prefix.Describe the solution you'd like
Add a string/int
nice
config parameter tocargo.toml
, under[build]
.If
int
: An absolute valuecargo
has to attempt to set thenice
value to on compilation threads/processes.If
string
: A "relative" value (-2
,+5
) to try to set to on compilation threads/processes.This setting is ignored on targets which don't support
nice
-esc prioritisation (windows comes to mind), though maybe a genericpriority
config value could be introduced which attempts to do this across many operating systems.If the
nice
value is less than the current value, and the current running-as user has no privilege to bump down the nice value, then it could/should be ignored with a warning printed to stderr or stdout.The text was updated successfully, but these errors were encountered: