Skip to content

Commit

Permalink
Add note about opt-level surprising results
Browse files Browse the repository at this point in the history
  • Loading branch information
johnthagen committed Oct 17, 2023
1 parent e413cf9 commit 9285dda
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ which optimizes the binary for **speed**. To instruct Cargo to optimize for mini
opt-level = "z" # Optimize for size.
```

Note that in some cases the `"s"` level may result in a smaller binary than `"z"`, as explained in
the
[`opt-level` documentation](https://doc.rust-lang.org/cargo/reference/profiles.html#opt-level):

> It is recommended to experiment with different levels to find the right balance for your project.
There may be surprising results, such as ... the `"s"` and `"z"` levels not being necessarily
smaller.

# Enable Link Time Optimization (LTO)

![Minimum Rust: 1.0](https://img.shields.io/badge/Minimum%20Rust%20Version-1.0-brightgreen.svg)
Expand Down

0 comments on commit 9285dda

Please sign in to comment.