This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Speed up SHF_MERGE|SHF_STRINGS split
AbandonedPublicDraft

Authored by MaskRay on Dec 17 2021, 10:05 PM.

Details

Reviewers
None
Summary

Splitting SHF_MERGE|SHF_STRINGS with sh_entsize=1 is a bottleneck linking a
program with large .debug_str in -O1/-O2 mode. This patch picks up D45571 with
small changes to speed up splitting.
We could also use other algorithms like weakened poly1305 but I am unsure the complexity
justifies.

Old:

jq -r '.traceEvents[] | select(.name|startswith("Total")) | "\(.dur/1000000) \(.name)"'
4.45245 Total ExecuteLinker
4.446075 Total Link
2.896229 Total Merge/finalize input sections
0.768235 Total Write output file
0.220198 Total Parse input files

New:

3.659616 Total ExecuteLinker
3.653682 Total Link
2.15211 Total Merge/finalize input sections
0.775001 Total Write output file
0.22633 Total Parse input files

I have adjusted some tests to demonstrate the effects.
If accepted I'll fix all the remaining tests.

Diff Detail

Event Timeline

MaskRay created this revision.Dec 17 2021, 10:05 PM
MaskRay abandoned this revision.Feb 9 2022, 5:42 PM

Pushed a simplified form. Computing length along with hash does not seem to improve performance.

Herald added a project: Restricted Project. · View Herald TranscriptFeb 9 2022, 5:42 PM