Skip to content

Commit

Permalink
Enable only debugging line tables
Browse files Browse the repository at this point in the history
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
benesch/materialize@a618135
  • Loading branch information
scottopell committed Dec 2, 2022
1 parent 2d46f2b commit f1dc406
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit f1dc406

Please sign in to comment.