[PATCH] D33428: [PDB] Hash types up front when merging types instead of using StringMap

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 22 18:33:32 PDT 2017


rnk created this revision.

First, StringMap uses llvm::HashString, which is only good for short
identifiers and really bad for large blobs of binary data like type
records. Moving to `DenseMap<StringRef, TypeIndex>` with some tricks for
memory allocation fixes that.

Unfortunately, that didn't buy very much performance. Profiling showed
that we spend a long time during DenseMap growth rehashing existing
entries. Also, in general, DenseMap is faster when the keys are small.
This change takes that to the logical conclusion by introducing a small
wrapper value type around a pointer to key data. The key data contains a
precomputed hash, the original record data (pointer and size), and the
type index, which is the "value" of our original map.

This reduces the time to produce llvm-as.exe and llvm-as.pdb from ~15s
on my machine to 3.5s, which is about a 4x improvement.


https://reviews.llvm.org/D33428

Files:
  llvm/include/llvm/DebugInfo/CodeView/TypeSerializer.h
  llvm/lib/DebugInfo/CodeView/TypeSerializer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33428.99840.patch
Type: text/x-patch
Size: 10192 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170523/a47c1645/attachment.bin>


More information about the llvm-commits mailing list