Skip to content

Commit 9b6de01

Browse files
no1wudixiaoxiang781216
authored andcommitted
rust/hello: Optimize the build flags
Summary: - Added `codegen-units = 1` and `opt-level = 'z'` to the release profile in `Cargo.toml` - These changes optimize the build for minimal binary size Impact: - Reduces the final binary size by ~7% (244316 -> 228380 bytes) - Improves resource utilization for embedded systems - No functional changes to the application behavior Signed-off-by: Huang Qi <[email protected]>
1 parent 6669372 commit 9b6de01

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/rust/hello/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ crate-type = ["staticlib"]
99
[profile.dev]
1010
panic = "abort"
1111

12-
# Special hanlding for the panic! macro, can be removed once
13-
# the libstd port for NuttX is complete.
1412
[profile.release]
1513
panic = "abort"
1614
lto = true
15+
codegen-units = 1
16+
opt-level = 'z'
1717

1818
[dependencies]
1919
serde = { version = "1.0", features = ["derive"] }

0 commit comments

Comments
 (0)