This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold][patch] Reduce heap usage for string merge sections
> The average string size for .rodata string merge sections (in my
> benchmark) is 13.5 chars; for .debug_str sections, it's 38.3 chars. I
> went with a fixed estimate for number of strings as (len / 32 + 8),
> and that improved heap usage over not reserving at all by about 7% (90
> MB out of 1.3 GB).
Some actual numbers from tcmalloc (numbers are total in-use heap,
taken near the end of pass 1, and at end of link):
Original gold: 2253.8 MB, 3468.3 MB
With latest patch: 1317.7 MB, 1926.4 MB
With 32-char estimate: 1227.2 MB, 1926.4 MB
Focusing in on Output_merge_string::do_add_input_section:
Original gold: 1725.9 MB, 1725.9 MB
With latest patch: 835.4 MB, 184.0 MB
With 32-char estimate: 743.6 MB, 184.0 MB
Focusing in on Output_merge_string::finalize_merged_data (this is
where we convert the per-output section mappings to per-input-section
mappings):
All three: 0, 776.1 MB
I think there's room for improvement here, too.
The benchmark is a 1.1 GB binary, built with -O2 and -g, and the total
size of all the input files is 3.5 GB (with compressed debug sections)
or 5.2 GB (with regular debug sections).
-cary