rust-lang / triagebot

Automation/tooling for Rust spaces
https://triage.rust-lang.org
Apache License 2.0
169 stars 75 forks source link

Add build profile optimized for binary size #1765

Closed apiraino closed 5 months ago

apiraino commented 5 months ago

This patch adds a new build profile optimized for binary size.

If we exclude the triagebot application, when building the other binaries under ./src/bin I think it can make sense to optimize for binary size rathen than performance. When taken to the extreme (as in this patch), the differenze is just huge, see the following table (rust nightly 1.77):

$ la -h target/{release,opt-size}/{compiler,types,lang,prioritization-agenda}
-rwxr-xr-x 2 me me 4.0M Jan 24 17:13 target/opt-size/compiler
-rwxr-xr-x 2 me me 4.1M Jan 24 17:13 target/opt-size/lang
-rwxr-xr-x 2 me me 4.1M Jan 24 17:13 target/opt-size/prioritization-agenda
-rwxr-xr-x 2 me me 4.0M Jan 24 17:13 target/opt-size/types
-rwxr-xr-x 2 me me 140M Jan 24 17:21 target/release/compiler
-rwxr-xr-x 2 me me 141M Jan 24 17:21 target/release/lang
-rwxr-xr-x 2 me me 141M Jan 24 17:21 target/release/prioritization-agenda
-rwxr-xr-x 2 me me 140M Jan 24 17:21 target/release/types

I like to run the build of these ancillary tools with cargo build --bins --profile=opt-size.

Opinions?

Thanks for a review.