Tricks to improve optimization level?

As far as I understand, --release is also a rather confusing flag that was originally (and still is?) only intended for use by “system package maintainers”

For an example of something that might be unexpected, if the preferred_optimize_mode field is set in StandardOptimizeOptionOptions, then the <mode> in --release=<mode> is silently ignored (and this behavior is intentional).

Relevant issues/PRs:

Personally, I avoid --release/preferred_optimize_mode entirely. Somewhere down the line hopefully this stuff will become less confusing, though (as mentioned in this PR, breaking changes to these APIs in the future are very likely).

5 Likes