From f14a047e8b03312edfb24f17835a3dd6ab181be3 Mon Sep 17 00:00:00 2001 From: Manuel Bichler Date: Sun, 27 Oct 2024 19:32:58 +0100 Subject: [PATCH 1/2] Update 08_overflow.md if you read threw the profile docs it provides 4 profiles. https://doc.rust-lang.org/cargo/reference/profiles.html --- book/src/02_basic_calculator/08_overflow.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/src/02_basic_calculator/08_overflow.md b/book/src/02_basic_calculator/08_overflow.md index aaaf8f5ec..f5a1f7c4b 100644 --- a/book/src/02_basic_calculator/08_overflow.md +++ b/book/src/02_basic_calculator/08_overflow.md @@ -69,7 +69,7 @@ You may be wondering—what is a profile setting? Let's get into that! A [**profile**](https://doc.rust-lang.org/cargo/reference/profiles.html) is a set of configuration options that can be used to customize the way Rust code is compiled. -Cargo provides two built-in profiles: `dev` and `release`.\ +Cargo provides 4 built-in profiles: `dev`, `release`, `test`, and `bench`.\ The `dev` profile is used every time you run `cargo build`, `cargo run` or `cargo test`. It's aimed at local development, therefore it sacrifices runtime performance in favor of faster compilation times and a better debugging experience.\ From f4a7472f30bb0d93d852b83a3e6373c257e4b09c Mon Sep 17 00:00:00 2001 From: Manuel Bichler Date: Tue, 29 Oct 2024 15:40:56 +0100 Subject: [PATCH 2/2] Update 08_overflow.md Added some context. --- book/src/02_basic_calculator/08_overflow.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/book/src/02_basic_calculator/08_overflow.md b/book/src/02_basic_calculator/08_overflow.md index f5a1f7c4b..feaa0e93f 100644 --- a/book/src/02_basic_calculator/08_overflow.md +++ b/book/src/02_basic_calculator/08_overflow.md @@ -75,6 +75,12 @@ development, therefore it sacrifices runtime performance in favor of faster compilation times and a better debugging experience.\ The `release` profile, instead, is optimized for runtime performance but incurs longer compilation times. You need to explicitly request via the `--release` flag—e.g. `cargo build --release` or `cargo run --release`. +The `test` profile is the default profile used by `cargo test`. The `test` profile inherits the settings form the `dev` profile. +The `bench` profile is the default profile used by `cargo bench`. The `bench` profile inherits from the `release` profile. +Use `dev` for iterative development and debugging, `release` for optimized production builds,\ +`test` for correctness testing, and `bench` for performance benchmarking. + + > "Have you built your project in release mode?" is almost a meme in the Rust community.\ > It refers to developers who are not familiar with Rust and complain about its performance on