From 17b979a90163af92877cfd506634c9115d9595d3 Mon Sep 17 00:00:00 2001 From: Erik Desjardins Date: Wed, 13 Mar 2024 19:11:17 -0400 Subject: [PATCH] compile backtrace-related deps with `opt-level=s` 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. --- Cargo.toml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 5dd315ef2f7c6..c9775dc36d6e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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.