mirror of
https://github.com/facebookresearch/faiss.git
synced 2026-10-12 02:13:36 +00:00
Reserve cs vector capacity in hammings_knn_mc_impl to avoid reallocations (#5548)
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/5548 Reviewed By: rjaber Differential Revision: D118055043 fbshipit-source-id: 47f6ecdf6197610ccbcd60a466a3bfc77cfcc4e1
This commit is contained in:
committed by
meta-codesync[bot]
parent
3a716ead1a
commit
af9eeffcf7
@@ -149,6 +149,7 @@ void hammings_knn_mc_impl(
|
||||
std::unique_ptr<int64_t[]> all_ids_per_dis(new int64_t[na * nBuckets * k]);
|
||||
|
||||
std::vector<HCounterState<HammingComputer>> cs;
|
||||
cs.reserve(na);
|
||||
for (size_t i = 0; i < na; ++i) {
|
||||
cs.push_back(
|
||||
HCounterState<HammingComputer>(
|
||||
|
||||
Reference in New Issue
Block a user