You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support cargo build --load-average / -l like GNU make #7480
I am trying to limit the load on my system while building Rust software.
Describe the solution you'd like
GNU make supports a make -l4 / make --load-average=4 parameter, that allows me to limit the target system load to 4 (e.g.). It would be nice, if Cargo would support the same.
I did some quick googling and found this answer: https://stackoverflow.com/a/13355071 . It seems the author prefers using a -j option, and in cargo, the -j option is implemented, do you think you can use that instead to limit the load?
-j does not care about the load on the system. Keep in mind that many processes can create load, not just make or cargo. Spawning many compilation tasks, where each uses -j N (or worse, unbounded -j), can bring a system to halt. -l M prevents that reasonably well.
I think the author of that answer also makes the mistake of passing an unbounded -j in combination with -l. If one passes a limit as in -j 6 -l 4, then make will spawn up to 6 processes, but only when the load does not exceed 4.
Activity
guanqun commentedon Oct 28, 2019
I did some quick googling and found this answer: https://stackoverflow.com/a/13355071 . It seems the author prefers using a
-joption, and incargo, the-joption is implemented, do you think you can use that instead to limit the load?devurandom commentedon Oct 28, 2019
-jdoes not care about the load on the system. Keep in mind that many processes can create load, not justmakeorcargo. Spawning many compilation tasks, where each uses-j N(or worse, unbounded-j), can bring a system to halt.-l Mprevents that reasonably well.I think the author of that answer also makes the mistake of passing an unbounded
-jin combination with-l. If one passes a limit as in-j 6 -l 4, thenmakewill spawn up to 6 processes, but only when the load does not exceed 4.jaccc commentedon Apr 11, 2021
it would be useful
weihanglo commentedon Nov 2, 2023
Not aware of this issue until today! Seems like it is #8556 with a specific solution in mind
epage commentedon Nov 3, 2023
Closing in favor of #12912 so we keep the conversation in one place.