diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2024-01-16 17:07:05 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2024-01-16 17:07:05 +0000 |
commit | 802cc7f81943675a1f0585645a21efc7340b84fb (patch) | |
tree | f8b4620db138e5ba8dada660846615a13af1d444 /searchlib | |
parent | 3583d425668e648ba0fd2702d2e011bae7b7a55d (diff) |
Improve comment and make assert more explicit.
Diffstat (limited to 'searchlib')
-rw-r--r-- | searchlib/src/vespa/searchlib/common/bitvector.cpp | 6 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/common/bitvector.h | 1 |
2 files changed, 3 insertions, 4 deletions
diff --git a/searchlib/src/vespa/searchlib/common/bitvector.cpp b/searchlib/src/vespa/searchlib/common/bitvector.cpp index 2297e886916..4f1d3a3a72c 100644 --- a/searchlib/src/vespa/searchlib/common/bitvector.cpp +++ b/searchlib/src/vespa/searchlib/common/bitvector.cpp @@ -66,20 +66,18 @@ BitVector::parallellOr(vespalib::ThreadBundle & thread_bundle, vespalib::ConstAr size_t max_num_chunks = (size + (MIN_BITS_PER_THREAD - 1)) / MIN_BITS_PER_THREAD; size_t max_threads = std::max(1ul, std::min(thread_bundle.size(), max_num_chunks)); - uint32_t bits_per_thread = size/max_threads; if (max_threads < 2) { for (uint32_t i(1); i < vectors.size(); i++) { master->orWith(*vectors[i]); } } else { - Index startIndex = master->getStartIndex(); for (const BitVector *bv: vectors) { - assert(bv->getStartIndex() == startIndex); + assert(bv->getStartIndex() == 0u); assert(bv->size() == size); } std::vector<BitVector::OrParts> parts; parts.reserve(max_threads); - bits_per_thread = (bits_per_thread/ALIGNMENT_BITS) * ALIGNMENT_BITS; + uint32_t bits_per_thread = ((size/max_threads)/ALIGNMENT_BITS) * ALIGNMENT_BITS; Index offset = 0; for (uint32_t i(0); (i + 1) < max_threads; i++) { parts.emplace_back(vectors, offset, bits_per_thread); diff --git a/searchlib/src/vespa/searchlib/common/bitvector.h b/searchlib/src/vespa/searchlib/common/bitvector.h index c403ce0d8a9..30d01c4a58b 100644 --- a/searchlib/src/vespa/searchlib/common/bitvector.h +++ b/searchlib/src/vespa/searchlib/common/bitvector.h @@ -285,6 +285,7 @@ public: static void consider_enable_range_check(); /** * Will slice the vectors and if possible use the thread bundle do the operation in parallell + * The result of the operation ends up in the first vector. * TODO: Extend to handle both AND/OR */ static void parallellOr(vespalib::ThreadBundle & thread_bundle, vespalib::ConstArrayRef<BitVector *> vectors); |