From 9285ddab4c649cfc36d6adb57674aec8a30ae24b Mon Sep 17 00:00:00 2001 From: johnthagen Date: Tue, 17 Oct 2023 11:47:15 -0400 Subject: [PATCH] Add note about opt-level surprising results --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index c3fa527..3a356dc 100644 --- a/README.md +++ b/README.md @@ -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)