by CodesInChaos · 1y ago · 0 comments
How big are the uncompressed debug symbols? I'd expected processing uncompressed debug symbols to happen via a memory mapped file, while compressed debug symbols probably need to be extracted to anonymous memory.
cargo build --bin engine-gateway --release
Finished `release` profile [optimized + debuginfo] target(s) in 1m 00s
ls -lh target/release/engine-gateway
.rwxr-xr-x erebe erebe 198 MB Sun Jan 19 12:37:35 2025 target/release/engine-gateway
what we ship export RUSTFLAGS="-C link-arg=-Wl,--compress-debug-sections=zlib -C force-frame-pointers=yes"
cargo build --bin engine-gateway --release
Finished `release` profile [optimized + debuginfo] target(s) in 1m 04s
ls -lh target/release/engine-gateway
.rwxr-xr-x erebe erebe 61 MB Sun Jan 19 12:39:13 2025 target/release/engine-gateway
The diff is more impressive on some bigger projectsFor this particular service, the size does not matter really. For others, it makes more diff (several hundred of Mb) and as we deploy on customers infra, we want images' size to stay reasonable. For now, we apply the same build rules for all our services to stay consistent.
Smaller executables are more for things like reducing distribution sizes, or reducing process launch latency when disk throughput is the issue. When you invoke compression, you are explicitly trading off runtime performance in order to get the benefit of smaller on-disk or network transmission size. For a hosted service, that's usually not a good tradeoff.