Skip to content

Commit f90bc6e

Browse files
committed
Optimize release build size
1 parent b1ee70c commit f90bc6e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Cargo.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ edition = '2024'
77

88
# https://github.com/johnthagen/min-sized-rust
99
[profile.release]
10-
lto = true # Enable link-time optimization
11-
codegen-units = 1 # Reduce number of codegen units to increase optimizations
12-
panic = 'abort' # Abort on panic
13-
strip = true # Strip symbols from binary
10+
codegen-units = 1 # reduces binary size by ~2%
11+
debug = "full" # No one needs an undebuggable release binary
12+
lto = true # reduces binary size by ~14%
13+
opt-level = "s" # reduces binary size by ~25%
14+
panic = "abort" # reduces binary size by ~50% in combination with -Zbuild-std-features=panic_immediate_abort
15+
split-debuginfo = "packed" # generates a seperate *.dwp/*.dSYM so the binary can get stripped
16+
strip = "symbols" # See split-debuginfo - allows us to drop the size by ~65%
1417

1518
[dependencies]
1619
axum = "0.8"

0 commit comments

Comments
 (0)