Skip to content

Commit

Permalink
build: add profile for small binary sizes
Browse files Browse the repository at this point in the history
This commit adds the "small" profile to Cargo.toml, optimized for
small binary sizes. To use it, simply run:

$ cargo build --profile=small

Using this profile, the holod binary size shrinks to 12M on my machine,
down from 21M with the default "release" profile.

Signed-off-by: Renato Westphal <[email protected]>
  • Loading branch information
rwestphal committed Feb 24, 2024
1 parent ca43367 commit 4a57ef1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,10 @@ unsafe_code = "forbid"
too_many_arguments = "allow"

[profile.release]
lto = true
codegen-units = 1
lto = true # Enable link-time optimization for improved runtime performance
codegen-units = 1 # Set the number of codegen units to 1 to increase optimization opportunities

[profile.small]
inherits = "release" # Inherit settings from the release profile
opt-level = "z" # Optimize for small binary size
strip = true # Strip symbols to further reduce binary size

0 comments on commit 4a57ef1

Please sign in to comment.