You are viewing a single thread.
View all comments View context
8 points

There is no deep explanation or anything.

Release profile defaults to -O3. -Oz compromises runtime performance for binary size.

When you start seeing for example network services which are not going to be running in constrained environments, nor do they restrict themselves from using heap allocations and all, when you see them set -Oz in their release profiles. Then you start to see small beginner projects setting it like OP here. You start to wonder if it’s a pattern, and the settings are being copied from somewhere else, with potential misconceptions like thinking it can meaningfully reduce runtime memory usage or something.

I actually think I found the culprit, thanks to one of the projects I was hinting at mentioning it:

https://github.com/johnthagen/min-sized-rust

Looks like we have a second wave of net-negative common wisdom in the ecosystem, the first being optimizing for dependencies’ compile times. But this one is not nearly as bad, as it doesn’t affect libraries.

permalink
report
parent
reply

Rust

!rust@programming.dev

Create post

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)

Community stats

  • 607

    Monthly active users

  • 245

    Posts

  • 827

    Comments