[PATCH] D115993: [ELF] Optimize RelocationSection<ELFT>::writeTo
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 18 11:25:13 PST 2021
MaskRay created this revision.
MaskRay added reviewers: arichardson, ikudrin, peter.smith.
Herald added a subscriber: emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
When linking a 1.2G output (nearly no debug info, 2846621 dynamic relocations) using `--threads=8`, I measured
9.131462 Total ExecuteLinker
1.449913 Total Write output file
1.445784 Total Write sections
0.657152 Write sections {"detail":".rela.dyn"}
This change decreases the .rela.dyn time to 0.25, leading to 4% speed up in the total time.
- The parallelSort is slow because of expensive r_sym/r_offset computation. Cache the values.
- The iteration is slow. Move r_sym/r_addend computation ahead of time and parallelize it.
With the change, the new encodeDynamicReloc is cheap (0.05s). So don't parallelize it.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D115993
Files:
lld/ELF/OutputSections.cpp
lld/ELF/SyntheticSections.cpp
lld/ELF/SyntheticSections.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115993.395302.patch
Type: text/x-patch
Size: 6239 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211218/af9b3a08/attachment.bin>
More information about the llvm-commits
mailing list