Description
I expected to see this happen: when split-debuginfo="unpacked" or split-debuginfo="packed" implies the debug info lives outside the executable so I'd expect the size to be very similar to strip = "debuginfo"
. However, the final binary size with strip=debuginfo
is >3x smaller which is a pretty significant disparity. Full LTO can lower that to just under 3x but that's still a big pill to swallow. Rusts' strip = "debuginfo"
option fully discards the debug info which isn't as nice in CI systems where you'd want to maybe upload the debuginfo to a symbol server (which I was hoping "packed" would be a path for), but that's a different issue.
Instead, this happened:
strip = "debuginfo" => 4.5M executable
split-debuginfo = "packed" => 15M executable
split-debuginfo = "unpacked" => 15M executable
Fat LTO reduces the size from 15M to 12M while the stripped size goes from 4.5M to 3.5M (without LTO the sizes are 18M and 4.6M respectively). This is with LLD or mold by the way - the default linker seems to be worse at eliminating debug information altogether where the ThinLTO size goes from 15M -> 18M although the stripped version goes from 4.5M -> 4.4M).
Meta
Nightly shows identical results.
rustc --version --verbose
:
rustc 1.77.0 (aedd173a2 2024-03-17)
rustc 1.78.0-nightly (bb594538f 2024-02-20)