Skip to content

Commit

Permalink
compile backtrace-related deps with opt-level=s
Browse files Browse the repository at this point in the history
Locally, this shrinks a stripped helloworld by 8k (~2%),
which isn't huge but it's something.

I also tried `opt-level=z` but it produces the same result.
`opt-level=s` is preferrable in that case since it inhibits fewer
optimizations.
  • Loading branch information
erikdesjardins committed Mar 13, 2024
1 parent 3cbb932 commit 17b979a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ adler.debug = 0
gimli.debug = 0
miniz_oxide.debug = 0
object.debug = 0
rustc-demangle.debug = 0
# Similar to above, as these libraries are used for backtrace symbolication,
# we can afford to sacrifice a small amount of performance in order to get
# smaller binaries by optimizing for size.
addr2line.opt-level = 's'
adler.opt-level = 's'
gimli.opt-level = 's'
miniz_oxide.opt-level = 's'
object.opt-level = 's'
rustc-demangle.opt-level = 's'

# These are very thin wrappers around executing lld with the right binary name.
# Basically nothing within them can go wrong without having been explicitly logged anyway.
Expand Down

0 comments on commit 17b979a

Please sign in to comment.