Skip to content

Commit

Permalink
rust/hello: Optimize the build flags
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
no1wudi authored and xiaoxiang781216 committed Jan 19, 2025
1 parent 6669372 commit 9b6de01
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/rust/hello/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ crate-type = ["staticlib"]
[profile.dev]
panic = "abort"

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

[dependencies]
serde = { version = "1.0", features = ["derive"] }
Expand Down

0 comments on commit 9b6de01

Please sign in to comment.