Understand build optimization for runtime speed

I read both:

What I don't understand is which speed gain I'm changing if I use:

[profile.release]
opt-level = "z"

instead of:

[profile.release]
opt-level = 3
  • Is it right that today opt-level = 3 is the best setting (for opt-level section) for runtime speed?

  • If I instead use opt-level = "z" I'm decreasing runtime performance, right?

I'm not interested in building/compiling speed.

Yes, opt-level 3 is the most efficient setting. You may also want to turn on lto and set codegen-units to 1 for optimal runtime performance.

And yes, opt-level z is the least performant optimization level.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.