During cargo run, rustc by default takes up all CPU resources. Is it possible to limit CPU usage? For example, cpulimit -l 40 works for cargo, but rustc processes still use 100% of the CPU.
UPD: cargo build -j x or CARGO_BUILD_JOBS=x this helped.
question was reducing cpu usage during cargo run.
-j 1 does only work for cargo build.
so the combined answer of all those helpful comments would be something like this:
CARGO_BUILD_JOBS=1 systemd-run --scope --user --property CPUQuota=50% cargo run
sidenote:
my problem was memory usage slowing the process down. to reduce the memory use:
CARGO_BUILD_JOBS=1 systemd-run --scope --user --property CPUQuota=50% --property MemoryMax=500M --property MemorySwapMax=0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With