Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust/hello: Optimize the build flags #2955

Merged
merged 1 commit into from
Jan 19, 2025
Merged

Conversation

no1wudi
Copy link
Contributor

@no1wudi no1wudi commented Jan 19, 2025

Summary

  • Removed the unused panic handler from the profile.dev and profile.release sections
  • Added codegen-units = 1 and opt-level = 'z' to the profile.release section to optimize the binary size
  • The changes result in a smaller binary size (244316 -> 228380 bytes)

Impact

  • Reduces the final binary size by ~7%, improving resource utilization
  • Maintains compatibility with existing functionality while optimizing for size
  • Simplifies the build configuration by removing unnecessary panic handler settings

Testing

Tested with sabre-6quad:nsh

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]>
@xiaoxiang781216 xiaoxiang781216 merged commit 9b6de01 into apache:master Jan 19, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants