[CodeView] Reserve TypeDatabase records up front.
Most of the time we know exactly how many type records we
have in a list, and we want to use the visitor to deserialize
them into actual records in a database. Previously we were
just using push_back() every time without reserving the space
up front in the vector. This is obviously terrible from a
performance standpoint, and it's not uncommon to have PDB
files with half a million type records, where the performance
degredation was quite noticeable.
llvm-svn: 302302
diff --git a/llvm/tools/llvm-pdbdump/Analyze.cpp b/llvm/tools/llvm-pdbdump/Analyze.cpp
index b65dd40..f7d6ec5 100644
--- a/llvm/tools/llvm-pdbdump/Analyze.cpp
+++ b/llvm/tools/llvm-pdbdump/Analyze.cpp
@@ -74,7 +74,7 @@
if (!Tpi)
return Tpi.takeError();
- TypeDatabase TypeDB;
+ TypeDatabase TypeDB(Tpi->getNumTypeRecords());
TypeDatabaseVisitor DBV(TypeDB);
TypeDeserializer Deserializer;
TypeVisitorCallbackPipeline Pipeline;