File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
book/src/02_basic_calculator Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -69,12 +69,18 @@ You may be wondering—what is a profile setting? Let's get into that!
69
69
A [ ** profile** ] ( https://doc.rust-lang.org/cargo/reference/profiles.html ) is a set of configuration options that can be
70
70
used to customize the way Rust code is compiled.
71
71
72
- Cargo provides two built-in profiles: ` dev ` and ` release ` .\
72
+ Cargo provides 4 built-in profiles: ` dev ` , ` release ` , ` test ` , and ` bench ` .\
73
73
The ` dev ` profile is used every time you run ` cargo build ` , ` cargo run ` or ` cargo test ` . It's aimed at local
74
74
development,
75
75
therefore it sacrifices runtime performance in favor of faster compilation times and a better debugging experience.\
76
76
The ` release ` profile, instead, is optimized for runtime performance but incurs longer compilation times. You need
77
77
to explicitly request via the ` --release ` flag—e.g. ` cargo build --release ` or ` cargo run --release ` .
78
+ The ` test ` profile is the default profile used by ` cargo test ` . The ` test ` profile inherits the settings form the ` dev ` profile.
79
+ The ` bench ` profile is the default profile used by ` cargo bench ` . The ` bench ` profile inherits from the ` release ` profile.
80
+ Use ` dev ` for iterative development and debugging, ` release ` for optimized production builds,\
81
+ ` test ` for correctness testing, and ` bench ` for performance benchmarking.
82
+
83
+
78
84
79
85
> "Have you built your project in release mode?" is almost a meme in the Rust community.\
80
86
> It refers to developers who are not familiar with Rust and complain about its performance on
You can’t perform that action at this time.
0 commit comments