diff options
| author | Scott Lagler <laglerscott@gmail.com> | 2025-12-12 19:20:21 -0500 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2025-12-16 17:45:24 -0500 |
| commit | 6138978808829172448615980742756831959788 (patch) | |
| tree | 746bb0a634c139967c1755dcbcfb8c3395b97ff5 /typearchive.cpp | |
| parent | 3967000448807875468673398445854536525610 (diff) | |
Add more reserve calls
Diffstat (limited to 'typearchive.cpp')
| -rw-r--r-- | typearchive.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/typearchive.cpp b/typearchive.cpp index ee2bd4df..c4cb865f 100644 --- a/typearchive.cpp +++ b/typearchive.cpp @@ -177,6 +177,7 @@ std::vector<std::string> TypeArchive::GetAllSnapshotIds() const throw ExceptionWithStackTrace("BNGetTypeArchiveAllSnapshotIds"); std::vector<std::string> result; + result.reserve(count); for (size_t i = 0; i < count; i ++) { result.push_back(ids[i]); @@ -195,6 +196,7 @@ std::vector<std::string> TypeArchive::GetSnapshotParentIds(const std::string& id throw ExceptionWithStackTrace("BNGetTypeArchiveSnapshotParentIds"); std::vector<std::string> result; + result.reserve(count); for (size_t i = 0; i < count; i ++) { result.push_back(ids[i]); @@ -213,6 +215,7 @@ std::vector<std::string> TypeArchive::GetSnapshotChildIds(const std::string& id) throw ExceptionWithStackTrace("BNGetTypeArchiveSnapshotChildIds"); std::vector<std::string> result; + result.reserve(count); for (size_t i = 0; i < count; i ++) { result.push_back(ids[i]); @@ -348,6 +351,7 @@ std::vector<std::string> TypeArchive::GetTypeIds(std::string snapshot) const throw ExceptionWithStackTrace("BNGetTypeArchiveTypeIds"); std::vector<std::string> result; + result.reserve(count); for (size_t i = 0; i < count; ++i) { result.push_back(ids[i]); @@ -367,6 +371,7 @@ std::vector<QualifiedName> TypeArchive::GetTypeNames(std::string snapshot) const throw ExceptionWithStackTrace("BNGetTypeArchiveTypeNames"); std::vector<QualifiedName> 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<void(const std::st ctxt.func = func; std::vector<const char*> apiParents; + apiParents.reserve(parents.size()); for (const auto& parent: parents) { apiParents.push_back(parent.c_str()); |
