diff options
author | Arne Juul <arnej@verizonmedia.com> | 2020-06-24 13:31:10 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2020-06-25 06:36:53 +0000 |
commit | 8a5e393a17979ee3252fa9b23e7e24414b1e4743 (patch) | |
tree | 8a4f6436dfc2fcee9f70a1523310339ea66a329d /searchlib | |
parent | d1f1ff08b82a842b353546cee258a637de056644 (diff) |
move read guard around instead of copying it
Diffstat (limited to 'searchlib')
-rw-r--r-- | searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp | 4 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/tensor/hnsw_index.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp index f236d525a9a..2a17378f58a 100644 --- a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp +++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp @@ -299,7 +299,7 @@ HnswIndex::internal_prepare_add(uint32_t docid, TypedCells input_vector, vespali { // TODO: Add capping on num_levels int level = _level_generator->max_level(); - PreparedAddDoc op(docid, level, read_guard); + PreparedAddDoc op(docid, level, std::move(read_guard)); auto entry = _graph.get_entry_node(); if (entry.docid == 0) { // graph has no entry point @@ -380,7 +380,7 @@ HnswIndex::prepare_add_document(uint32_t docid, // to ensure they are linked together: return std::unique_ptr<PrepareResult>(); } - PreparedAddDoc op = internal_prepare_add(docid, vector, read_guard); + PreparedAddDoc op = internal_prepare_add(docid, vector, std::move(read_guard)); return std::make_unique<PreparedAddDoc>(std::move(op)); } diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index.h b/searchlib/src/vespa/searchlib/tensor/hnsw_index.h index 6acf269507d..f9adef0b86c 100644 --- a/searchlib/src/vespa/searchlib/tensor/hnsw_index.h +++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index.h @@ -134,7 +134,7 @@ protected: std::vector<Links> connections; PreparedAddDoc(uint32_t docid_in, int32_t max_level_in, ReadGuard read_guard_in) : docid(docid_in), max_level(max_level_in), - read_guard(read_guard_in), + read_guard(std::move(read_guard_in)), connections(max_level+1) {} ~PreparedAddDoc() = default; |