]> granicus.if.org Git - llvm/commit
[CV Type Merging] Find nested type indices faster.
authorZachary Turner <zturner@google.com>
Thu, 25 May 2017 23:36:16 +0000 (23:36 +0000)
committerZachary Turner <zturner@google.com>
Thu, 25 May 2017 23:36:16 +0000 (23:36 +0000)
commitf061f6ca68a19b187b54b4dbb13c9ea73863a01f
tree35572079a8abb33270d5006cd4e85dfaa19b8cdd
parenta8d58fe0effc74eb39541d7c356547fafb0b1326
[CV Type Merging] Find nested type indices faster.

Merging two type streams is one of the most time consuming
parts of generating a PDB, and as such it needs to be as
fast as possible.  The visitor abstractions used for interoperating
nicely with many different types of inputs and outputs have
been used widely and help greatly for testability and implementing
tools, but the abstractions build up and get in the way of
performance.

This patch removes all of the visitation stuff from the type
stream merger, essentially re-inventing the leaf / member switch
and loop, but at a very low level.  This allows us many other
optimizations, such as not actually deserializing *any* records
(even member records which don't describe their own length), as
the operation of "figure out how long this record is" is somewhat
faster than "figure out how long this record *and* get all its
fields out".  Furthermore, whereas before we had to deserialize,
re-write type indices, then re-serialize, now we don't have to
do any of those 3 steps.  We just find out where the type indices
are and pull them directly out of the byte stream and re-write
them.

This is worth a 50-60% performance increase.  On top of all other
optimizations that have been applied this week, I now get the
following numbers when linking lld.exe and lld.pdb

MSVC: 25.67s
Before This Patch: 18.59s
After This Patch: 8.92s

So this is a huge performance win.

Differential Revision: https://reviews.llvm.org/D33564

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303935 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h [new file with mode: 0644]
include/llvm/DebugInfo/CodeView/TypeRecord.h
lib/DebugInfo/CodeView/CMakeLists.txt
lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp [new file with mode: 0644]
lib/DebugInfo/CodeView/TypeStreamMerger.cpp
unittests/DebugInfo/CodeView/CMakeLists.txt
unittests/DebugInfo/CodeView/ErrorChecking.h
unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp [new file with mode: 0644]