this post was submitted on 14 Aug 2024
27 points (96.6% liked)

Rust

5749 readers
7 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
 

Planning to build a PC in couple of weeks.

What is the optimal number of cores to have without having diminishing returns?

you are viewing a single comment's thread
view the rest of the comments
[–] verstra@programming.dev 15 points 4 weeks ago (1 children)

For a clean build: number of cores (because cargo builds each crate dependency in a separate process), for a build of your crate only: single core perf.

[–] BB_C@programming.dev 10 points 4 weeks ago (1 children)

for a build of your crate only: single core perf.

Until the parallel compiler feature (-Z threads=<n>) stabilizes and becomes more complete.

It's also always worth mentioning that the choice of linker is important. Using mold or lld can significantly speed things up in some use-cases.

Beyond that, codegen-units and lto profile options are also important.

And finally, for development purposes, the code generator is important, as cranelift provides much faster compile times, but resulting binaries are not as optimized as LLVM-generated ones.

[–] verstra@programming.dev 1 points 4 weeks ago

Oh, i have to try these out to see if it effects my development cycle. I do notice that cargo check is super fast, but cargo build takes a long time. So codegen and linker could be the source of slowness.