summaryrefslogtreecommitdiffstats
path: root/searchlib/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-11-30 21:16:28 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-11-30 21:16:28 +0000
commit4a107de50e83de117fee14f7822e760f9166be39 (patch)
tree63f40a27456faa396fea9b4405a3cb27c6e12319 /searchlib/src
parentaa3ffac0caaba2c60fabc585be8376cfe132c17d (diff)
Reserve memory upfront.
Diffstat (limited to 'searchlib/src')
-rw-r--r--searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
index 847ed330fe8..2889dc425db 100644
--- a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
@@ -191,6 +191,7 @@ HnswIndex::remove_link_to(uint32_t remove_from, uint32_t remove_id, uint32_t lev
{
LinkArray new_links;
auto old_links = _graph.get_link_array(remove_from, level);
+ new_links.reserve(old_links.size());
for (uint32_t id : old_links) {
if (id != remove_id) new_links.push_back(id);
}