Skip to content

Commit 9a1ac7d

Browse files
committed
Update release build with options to reduce binary size
1 parent 35dabc9 commit 9a1ac7d

File tree

7 files changed

+51
-30
lines changed

7 files changed

+51
-30
lines changed

dsc/Cargo.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ version = "3.1.0-preview.5"
44
edition = "2021"
55

66
[profile.release]
7-
strip = true
8-
# optimize for size
9-
opt-level = 2
10-
# enable link time optimization to remove dead code
11-
lto = true
7+
codegen-units = 1 # reduces binary size by ~2%
8+
debug = "full" # No one needs an undebuggable release binary
9+
lto = true # reduces binary size by ~14%
10+
opt-level = "s" # reduces binary size by ~25%
11+
panic = "abort" # reduces binary size by ~50% in combination with -Zbuild-std-features=panic_immediate_abort
12+
split-debuginfo = "packed" # generates a seperate *.dwp/*.dSYM so the binary can get stripped
13+
strip = "symbols" # See split-debuginfo - allows us to drop the size by ~65%
1214

1315
[dependencies]
1416
clap = { version = "4.5", features = ["derive"] }

dsc_lib/Cargo.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ version = "3.0.0"
44
edition = "2021"
55

66
[profile.release]
7-
strip = true
8-
# optimize for size
9-
opt-level = 2
10-
# enable link time optimization to remove dead code
11-
lto = true
7+
codegen-units = 1 # reduces binary size by ~2%
8+
debug = "full" # No one needs an undebuggable release binary
9+
lto = true # reduces binary size by ~14%
10+
opt-level = "s" # reduces binary size by ~25%
11+
panic = "abort" # reduces binary size by ~50% in combination with -Zbuild-std-features=panic_immediate_abort
12+
split-debuginfo = "packed" # generates a seperate *.dwp/*.dSYM so the binary can get stripped
13+
strip = "symbols" # See split-debuginfo - allows us to drop the size by ~65%
1214

1315
[dependencies]
1416
base64 = "0.22"

dscecho/Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ name = "dscecho"
33
version = "1.0.0"
44
edition = "2021"
55

6+
[profile.release]
7+
codegen-units = 1 # reduces binary size by ~2%
8+
debug = "full" # No one needs an undebuggable release binary
9+
lto = true # reduces binary size by ~14%
10+
opt-level = "s" # reduces binary size by ~25%
11+
panic = "abort" # reduces binary size by ~50% in combination with -Zbuild-std-features=panic_immediate_abort
12+
split-debuginfo = "packed" # generates a seperate *.dwp/*.dSYM so the binary can get stripped
13+
strip = "symbols" # See split-debuginfo - allows us to drop the size by ~65%
14+
615
[dependencies]
716
clap = { version = "4.1", features = ["derive"] }
817
rust-i18n = { version = "3.1" }

osinfo/Cargo.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ version = "0.1.0"
44
edition = "2021"
55

66
[profile.release]
7-
strip = true
8-
# optimize for size
9-
opt-level = 2
10-
# enable link time optimization to remove dead code
11-
lto = true
7+
codegen-units = 1 # reduces binary size by ~2%
8+
debug = "full" # No one needs an undebuggable release binary
9+
lto = true # reduces binary size by ~14%
10+
opt-level = "s" # reduces binary size by ~25%
11+
panic = "abort" # reduces binary size by ~50% in combination with -Zbuild-std-features=panic_immediate_abort
12+
split-debuginfo = "packed" # generates a seperate *.dwp/*.dSYM so the binary can get stripped
13+
strip = "symbols" # See split-debuginfo - allows us to drop the size by ~65%
1214

1315
[dependencies]
1416
os_info = { version = "3.7" }

registry/Cargo.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ default-locale = "en-us"
99
load-path = "locales"
1010

1111
[profile.release]
12-
strip = true
13-
# optimize for size
14-
opt-level = 2
15-
# enable link time optimization to remove dead code
16-
lto = true
12+
codegen-units = 1 # reduces binary size by ~2%
13+
debug = "full" # No one needs an undebuggable release binary
14+
lto = true # reduces binary size by ~14%
15+
opt-level = "s" # reduces binary size by ~25%
16+
panic = "abort" # reduces binary size by ~50% in combination with -Zbuild-std-features=panic_immediate_abort
17+
split-debuginfo = "packed" # generates a seperate *.dwp/*.dSYM so the binary can get stripped
18+
strip = "symbols" # See split-debuginfo - allows us to drop the size by ~65%
1719

1820
[dependencies]
1921
clap = { version = "4.5", features = ["derive"] }

runcommandonset/Cargo.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ version = "0.1.0"
44
edition = "2021"
55

66
[profile.release]
7-
strip = true
8-
# optimize for size
9-
opt-level = 2
10-
# enable link time optimization to remove dead code
11-
lto = true
7+
codegen-units = 1 # reduces binary size by ~2%
8+
debug = "full" # No one needs an undebuggable release binary
9+
lto = true # reduces binary size by ~14%
10+
opt-level = "s" # reduces binary size by ~25%
11+
panic = "abort" # reduces binary size by ~50% in combination with -Zbuild-std-features=panic_immediate_abort
12+
split-debuginfo = "packed" # generates a seperate *.dwp/*.dSYM so the binary can get stripped
13+
strip = "symbols" # See split-debuginfo - allows us to drop the size by ~65%
1214

1315
[dependencies]
1416
clap = { version = "4.4", features = ["derive"] }

y2j/Cargo.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ version = "1.0.0"
44
edition = "2021"
55

66
[profile.release]
7-
strip = true
8-
# optimize for size
9-
opt-level = 2
10-
# enable link time optimization to remove dead code
11-
lto = true
7+
codegen-units = 1 # reduces binary size by ~2%
8+
debug = "full" # No one needs an undebuggable release binary
9+
lto = true # reduces binary size by ~14%
10+
opt-level = "s" # reduces binary size by ~25%
11+
panic = "abort" # reduces binary size by ~50% in combination with -Zbuild-std-features=panic_immediate_abort
12+
split-debuginfo = "packed" # generates a seperate *.dwp/*.dSYM so the binary can get stripped
13+
strip = "symbols" # See split-debuginfo - allows us to drop the size by ~65%
1214

1315
[dependencies]
1416
serde_json = { version = "1.0.0", features = ["preserve_order"] }

0 commit comments

Comments
 (0)