Tips for compiling large rust projects with limited resources on windows?

Hello,

Recently while compiling a large rust project on windows, the compilation was so resource heavy that I could not multitask. The cause for it from my investigation was due to 2 things

  • Microsoft incremental linker eats way too much ram

  • Visual Studio Customer Experience was eating like 6% of CPU :frowning: (I tried everything to disable it as mentioned in there docs, but still it always comes up)

So to get around it I found the below solutions which isnt a ram hog and dosent start any unwanted process

  • use x86_64-pc-windows-gnu
  • use rust-lld as the linker for x86_64-pc-windows-msvc target
  • launch lesser parallel jobs

Would appreciate if there are any other suggestions to get around this. I want to know what knobs I can play with to find an optimal balance

For CPU load you could try starting the build process with a lower priority. But that won't help with the RAM footprint.

You can pass a --jobs flag to cargo build to set the number of things it'll try to build concurrently. That means you'll get less parallelism, so hopefully you'll have some cores left over to run everything else.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.