From f1dc406066bb014998c3b065c30fe3675f0efda3 Mon Sep 17 00:00:00 2001 From: Scott Opell Date: Fri, 2 Dec 2022 00:09:21 +0000 Subject: [PATCH] Enable only debugging line tables Before: $ bloaty target/release/libvrl_bridge.so FILE SIZE VM SIZE -------------- -------------- 37.9% 17.7Mi 0.0% 0 .debug_info 9.3% 4.35Mi 44.9% 4.35Mi .text 8.8% 4.12Mi 0.0% 0 .debug_loc 6.0% 2.80Mi 0.0% 0 .debug_str 5.9% 2.77Mi 0.0% 0 .debug_pubnames 5.3% 2.49Mi 0.0% 0 .debug_pubtypes 5.0% 2.34Mi 0.0% 0 .debug_line 3.9% 1.83Mi 0.0% 0 .strtab 3.6% 1.67Mi 0.0% 0 .symtab 3.2% 1.52Mi 15.7% 1.52Mi .data.rel.ro 3.1% 1.44Mi 14.9% 1.44Mi .rodata 3.0% 1.39Mi 14.3% 1.39Mi .rela.dyn 2.4% 1.10Mi 0.0% 0 .debug_ranges 1.3% 616Ki 6.2% 616Ki .eh_frame 0.5% 258Ki 2.6% 258Ki .gcc_except_table 0.3% 127Ki 0.0% 0 .debug_abbrev 0.2% 119Ki 0.0% 0 .debug_aranges 0.2% 107Ki 1.1% 107Ki .eh_frame_hdr 0.0% 20.6Ki 0.2% 20.6Ki .data 0.0% 10.6Ki 0.1% 12.3Ki [23 Others] 0.0% 2.50Ki 0.0% 0 [ELF Section Headers] 100.0% 46.8Mi 100.0% 9.69Mi TOTAL After: $ bloaty ./target/release/libvrl_bridge.so FILE SIZE VM SIZE -------------- -------------- 20.7% 5.51Mi 0.0% 0 .debug_info 16.3% 4.33Mi 44.8% 4.33Mi .text 9.4% 2.50Mi 0.0% 0 .debug_str 8.5% 2.27Mi 0.0% 0 .debug_line 7.7% 2.06Mi 0.0% 0 .debug_pubnames 6.9% 1.84Mi 0.0% 0 .strtab 6.2% 1.64Mi 0.0% 0 .symtab 5.7% 1.52Mi 15.7% 1.52Mi .data.rel.ro 5.4% 1.44Mi 15.0% 1.44Mi .rodata 5.2% 1.38Mi 14.3% 1.38Mi .rela.dyn 3.3% 911Ki 0.0% 0 .debug_ranges 2.2% 609Ki 6.2% 609Ki .eh_frame 0.9% 256Ki 2.6% 256Ki .gcc_except_table 0.4% 111Ki 0.0% 0 .debug_aranges 0.4% 105Ki 1.1% 105Ki .eh_frame_hdr 0.4% 98.4Ki 0.0% 0 .debug_loc 0.1% 28.0Ki 0.0% 0 .debug_abbrev 0.1% 20.6Ki 0.2% 20.6Ki .data 0.0% 12.4Ki 0.1% 12.3Ki [23 Others] 0.0% 6.12Ki 0.0% 0 .debug_pubtypes 0.0% 2.50Ki 0.0% 0 [ELF Section Headers] 100.0% 26.6Mi 100.0% 9.66Mi TOTAL Sources: https://doc.rust-lang.org/cargo/reference/profiles.html#debug https://github.com/benesch/materialize/commit/a6181353a472a4ea2375e671890d3c085b9f8913 --- Cargo.toml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index ca36ee2..3e37b37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,13 @@ version = "0.1.0" edition = "2021" [profile.release] -debug=true +# Emit only the line info tables, not full debug info, in release builds, to +# substantially reduce the size of the debug info. Line info tables are enough +# to symbolicate a backtrace, but not enough to use a debugger interactively. +# This seems to be the right tradeoff for release builds: it's unlikely we're +# going to get interactive access to a debugger in production installations, but +# we still want useful crash reports. +debug = 1 [lib] name = "vrl_bridge"