[PATCH] D32631: Speed up the -Map option.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 20:19:14 PDT 2017


ruiu created this revision.
Herald added a subscriber: mehdi_amini.

We found that some part of code for the -Map option takes O(m*n)
where m is the number of input sections in some file and n is
the number of symbols in the same file. If you do LTO, we usually
have only a few object files as inputs for the -Map option
feature, so this performance characteristic was worse than I
expected.

This patch rewrites the -Map option feature to speed it up.
I eliminated the O(m*n) bottleneck and also used multi-threading.

As a result, clang link time with the -Map option improved from
18.7 seconds to 11.2 seconds. Without -Map, it takes 7.7 seconds,
so the -Map option is now about 3x faster than before for this
test case (from 11.0 seconds to 3.5 seconds.) The generated output
file size was 223 MiB, and the file contains 1.2M lines.


https://reviews.llvm.org/D32631

Files:
  lld/ELF/MapFile.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32631.97038.patch
Type: text/x-patch
Size: 8057 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170428/a7ba705a/attachment-0001.bin>


More information about the llvm-commits mailing list