[lld] [lld][COFF] Remove duplicate strtab entries (PR #141197)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Mon May 26 05:16:31 PDT 2025
mstorsjo wrote:
> Blender strtab size for three methods.
>
> original strtab size stringmap strtab size strtabbuilder strtab size
> 630,474,756 373,099,443 342,999,672
> stringmap reduced -40.82% comparing to unoptimized strtab. stringtablebuilder further reduced -8.07%.
Thanks for looking into these numbers!
So using the StringTableBuilder does make a notable extra benefit on top of this, but using it would require a bit more extra effort than what I tried before.
With that in mind, I think this PR in itself looks like a straightforward improvement. We could consider switching to StringTableBuilder, if someone is willing to make the effort to handle the section name strings separately in one way or another - but it is a smaller improvement than this, and probably comes at a bigger runtime cost.
> Test needed. In ELF we can use `llvm-readelf -p .strtab` to dump the section table. I don't know what the COFF counterpart is.
Not sure if I think a test strictly is needed here; whether the strings are deduplicated or not is mostly a nonfunctional difference. (The previous similar change in https://github.com/llvm/llvm-project/commit/9ffeaaa0ea54307db309104696a0b6cce6ddda38 didn't have any test.) I'm not aware of any current `llvm-readobj` command or similar, that would actually dump the string table as such. (Also `obj2yaml` doesn't dump the string table, but only uses implicitly for resolving strings for all the referenced symbols.)
https://github.com/llvm/llvm-project/pull/141197
More information about the llvm-commits
mailing list