summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/CodeView
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-05-05 22:02:37 +0000
committerZachary Turner <zturner@google.com>2017-05-05 22:02:37 +0000
commit8c74673388f62f5f4bffc7e840d405c0914558a4 (patch)
tree87f70831bd1071a8186937241b62846eeab18b7e /llvm/lib/DebugInfo/CodeView
parentc1c569168611e312a698ab358fe18c7ea0eda4c6 (diff)
downloadbcm5719-llvm-8c74673388f62f5f4bffc7e840d405c0914558a4.tar.gz
bcm5719-llvm-8c74673388f62f5f4bffc7e840d405c0914558a4.zip
[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
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView')
-rw-r--r--llvm/lib/DebugInfo/CodeView/TypeDatabase.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/TypeDatabase.cpp b/llvm/lib/DebugInfo/CodeView/TypeDatabase.cpp
index efaba4646ff..5b8841041f8 100644
--- a/llvm/lib/DebugInfo/CodeView/TypeDatabase.cpp
+++ b/llvm/lib/DebugInfo/CodeView/TypeDatabase.cpp
@@ -65,6 +65,11 @@ static const SimpleTypeEntry SimpleTypeNames[] = {
{"__bool64*", SimpleTypeKind::Boolean64},
};
+TypeDatabase::TypeDatabase(uint32_t ExpectedSize) : TypeNameStorage(Allocator) {
+ CVUDTNames.reserve(ExpectedSize);
+ TypeRecords.reserve(ExpectedSize);
+}
+
/// Gets the type index for the next type record.
TypeIndex TypeDatabase::getNextTypeIndex() const {
return TypeIndex(TypeIndex::FirstNonSimpleIndex + CVUDTNames.size());
OpenPOWER on IntegriCloud