this post was submitted on 14 Nov 2024
21 points (95.7% liked)

Rust

5999 readers
25 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
you are viewing a single comment's thread
view the rest of the comments
[–] BB_C@programming.dev 7 points 1 day ago (1 children)

With all the respect to the author and his wild experiments, that title does not match the linker-only focus of the content.

So not only the post ended up with two (IMHO) bad recommendations (disabling debug info, building non-relocatable binaries with musl). But it also didn't mention other important factors like codegen-unitsand codegen-backend. Since you know, code generation is the other big contributor to the cycle time (the primary contributor even, in many cases). There is also other relevant options like lto and opt-level.

Let's assume that opt-level shouldn't be changed from defaults for no good reason.

With codegen-units, it's not the default that is the problem, but the fact that some projects set it to 1 (for performance optimization reasons), but without adding a separate profile for development release builds (let's call it release-dev).

Same goes for lto, where you can have it set to "full" in your optimized profile, and completely "off" in release-dev.

And finally, with codegen-backend, you can enjoy what is probably the biggest speed up in the cycle by using cranelift in your release-dev profile.

And of course you are not limited to just two release profiles. I usually use 3-4 myself. Profile inheritance makes this easy.

And finally, you can set/not set some of those selectively for your dependencies. For example, not using cranelift for dependencies can render the runtime performance delta negligible in some projects.


Using the parallel rustc front-end might become an interesting option too, but it's not ready yet.

[–] FizzyOrange@programming.dev 2 points 12 hours ago (1 children)

I think you're being way too harsh.

  1. His recommendations to disable debug info and PIC are not "bad". He isn't suggesting that should be the default. He actually only suggested that split debug info should be made the default on Linux which is a sensible suggestion.
  2. There are gazillions of other posts talking about codegen-units, cranelift and so on. I don't think we need a repeat (though he could have linked to them).

The focus on linking was because this post is introducing his liker project.

OP ignore this naysayer.

[–] BB_C@programming.dev 1 points 12 hours ago (1 children)
[–] FizzyOrange@programming.dev 1 points 11 hours ago

Ok that was maybe a bit unfair!