From 6138978808829172448615980742756831959788 Mon Sep 17 00:00:00 2001 From: Scott Lagler Date: Fri, 12 Dec 2025 19:20:21 -0500 Subject: Add more reserve calls --- typearchive.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'typearchive.cpp') diff --git a/typearchive.cpp b/typearchive.cpp index ee2bd4df..c4cb865f 100644 --- a/typearchive.cpp +++ b/typearchive.cpp @@ -177,6 +177,7 @@ std::vector TypeArchive::GetAllSnapshotIds() const throw ExceptionWithStackTrace("BNGetTypeArchiveAllSnapshotIds"); std::vector result; + result.reserve(count); for (size_t i = 0; i < count; i ++) { result.push_back(ids[i]); @@ -195,6 +196,7 @@ std::vector TypeArchive::GetSnapshotParentIds(const std::string& id throw ExceptionWithStackTrace("BNGetTypeArchiveSnapshotParentIds"); std::vector result; + result.reserve(count); for (size_t i = 0; i < count; i ++) { result.push_back(ids[i]); @@ -213,6 +215,7 @@ std::vector TypeArchive::GetSnapshotChildIds(const std::string& id) throw ExceptionWithStackTrace("BNGetTypeArchiveSnapshotChildIds"); std::vector result; + result.reserve(count); for (size_t i = 0; i < count; i ++) { result.push_back(ids[i]); @@ -348,6 +351,7 @@ std::vector TypeArchive::GetTypeIds(std::string snapshot) const throw ExceptionWithStackTrace("BNGetTypeArchiveTypeIds"); std::vector result; + result.reserve(count); for (size_t i = 0; i < count; ++i) { result.push_back(ids[i]); @@ -367,6 +371,7 @@ std::vector TypeArchive::GetTypeNames(std::string snapshot) const throw ExceptionWithStackTrace("BNGetTypeArchiveTypeNames"); std::vector result; + result.reserve(count); for (size_t i = 0; i < count; ++i) { result.push_back(QualifiedName::FromAPIObject(&names[i])); @@ -500,6 +505,7 @@ std::string TypeArchive::NewSnapshotTransaction(std::function apiParents; + apiParents.reserve(parents.size()); for (const auto& parent: parents) { apiParents.push_back(parent.c_str()); -- cgit v1.3.1