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:
generatedunixname1395027625275998
2026-08-31 12:19:45 -07:00
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>(