aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-03-21 11:17:52 -0700
committerGitHub <noreply@github.com>2024-03-21 11:17:52 -0700
commitf5ef9bd26d531d104f44f9e5b283bd2f80c024be (patch)
tree27d50478be2c77567fad184e4b33cbe7a4d0863a /llvm/lib/ProfileData
parent796efa8cd5800a42eb8362564be64f3d72512a05 (diff)
downloadllvm-f5ef9bd26d531d104f44f9e5b283bd2f80c024be.zip
llvm-f5ef9bd26d531d104f44f9e5b283bd2f80c024be.tar.gz
llvm-f5ef9bd26d531d104f44f9e5b283bd2f80c024be.tar.bz2
[memprof] Call SmallVector::reserve (#86055)
With one raw memprof file I have, NumPCs averages about 41. Given the default number of inline elements being 8 for SmallVector<uint64_t>, we should reserve the storage in advance.
Diffstat (limited to 'llvm/lib/ProfileData')
-rw-r--r--llvm/lib/ProfileData/RawMemProfReader.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/ProfileData/RawMemProfReader.cpp b/llvm/lib/ProfileData/RawMemProfReader.cpp
index 0e2b866..60c37c4 100644
--- a/llvm/lib/ProfileData/RawMemProfReader.cpp
+++ b/llvm/lib/ProfileData/RawMemProfReader.cpp
@@ -127,6 +127,7 @@ CallStackMap readStackInfo(const char *Ptr) {
endian::readNext<uint64_t, llvm::endianness::little, unaligned>(Ptr);
SmallVector<uint64_t> CallStack;
+ CallStack.reserve(NumPCs);
for (uint64_t J = 0; J < NumPCs; J++) {
CallStack.push_back(
endian::readNext<uint64_t, llvm::endianness::little, unaligned>(Ptr));