OSDN Git Service

Optimize StringTableBuilder.
authorRui Ueyama <ruiu@google.com>
Mon, 26 Oct 2015 19:58:29 +0000 (19:58 +0000)
committerRui Ueyama <ruiu@google.com>
Mon, 26 Oct 2015 19:58:29 +0000 (19:58 +0000)
commitd2a6a14ca4a8642f49ee081c1209543415bcb2fb
treeda7f35d48a10845e946b5d579f3d2cc217001a03
parentc2df33628af8c76d1789929226d46cf776b057d7
Optimize StringTableBuilder.

This is a patch to improve StringTableBuilder's performance. That class'
finalize function is very hot particularly in LLD because the function
does tail-merge strings in string tables or SHF_MERGE sections.

Generic std::sort-style sorter is not efficient for sorting strings.
The function implemented in this patch seems to be more efficient.

Here's a benchmark of LLD to link Clang with or without this patch.
The numbers are medians of 50 runs.

-O0
real 0m0.455s
real 0m0.430s (5.5% faster)

-O3
real 0m0.487s
real 0m0.452s (7.2% faster)

Since that is a benchmark of the whole linker, the speedup of
StringTableBuilder itself is much more than that.

http://reviews.llvm.org/D14053

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251337 91177308-0d34-0410-b5e6-96231b3b80d8
lib/MC/StringTableBuilder.cpp