From a450b6518160857af1221f43ba38945f2aa96571 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Fri, 29 Nov 2024 23:02:17 +0100 Subject: [PATCH] Don't reuse shared priority queue. --- .../sparse_vector_benchmark_test.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/searchlib/src/tests/queryeval/sparse_vector_benchmark/sparse_vector_benchmark_test.cpp b/searchlib/src/tests/queryeval/sparse_vector_benchmark/sparse_vector_benchmark_test.cpp index 329118fdf818..00224e4eda02 100644 --- a/searchlib/src/tests/queryeval/sparse_vector_benchmark/sparse_vector_benchmark_test.cpp +++ b/searchlib/src/tests/queryeval/sparse_vector_benchmark/sparse_vector_benchmark_test.cpp @@ -191,9 +191,9 @@ struct ModSearchFactory : ChildFactory { //----------------------------------------------------------------------------- struct VespaWandFactory : SparseVectorFactory { - mutable SharedWeakAndPriorityQueue _scores; + mutable std::unique_ptr _scores; uint32_t n; - explicit VespaWandFactory(uint32_t n_in) : _scores(n_in), n(n_in) {} + explicit VespaWandFactory(uint32_t n_in) : _scores(), n(n_in) {} std::string name() const override { return vespalib::make_string("VespaWand(%u)", n); } @@ -202,7 +202,9 @@ struct VespaWandFactory : SparseVectorFactory { for (size_t i = 0; i < childCnt; ++i) { terms.emplace_back(childFactory.createChild(i, limit), default_weight, limit / (i + 1)); } - return WeakAndSearch::create(terms, wand::MatchParams(_scores), n, true, false); + _scores = std::make_unique(n); + wand::MatchParams match_params(*_scores, wand::StopWordStrategy::none(), 1, limit); + return WeakAndSearch::create(terms, match_params, n, true, false); } };