[PATCH] D33488: [ELF] - Optimization for populating stringpool when building .gdb_index.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 04:14:56 PDT 2017


grimar created this revision.
Herald added a subscriber: emaste.

It is possible to speedup population of string pool just
by reusing precalculated hash value.

Tested llc binary to link, 50 runs each:
Without patch, with --gdb-index: 7,826269134 seconds time elapsed ( +-  0,06% )
With patch, with --gdb-index: 7,729554651 seconds time elapsed ( +- 0,11% )
A / B == 1,0125, or at least 1% for free.


https://reviews.llvm.org/D33488

Files:
  ELF/SyntheticSections.cpp


Index: ELF/SyntheticSections.cpp
===================================================================
--- ELF/SyntheticSections.cpp
+++ ELF/SyntheticSections.cpp
@@ -1771,7 +1771,7 @@
 
   for (std::pair<StringRef, uint8_t> &Pair : NamesAndTypes) {
     uint32_t Hash = hash(Pair.first);
-    size_t Offset = StringPool.add(Pair.first);
+    size_t Offset = StringPool.add({Pair.first, Hash});
 
     bool IsNew;
     GdbSymbol *Sym;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33488.100064.patch
Type: text/x-patch
Size: 433 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170524/e7e0251f/attachment.bin>


More information about the llvm-commits mailing list