summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorArne H Juul <arnej27959@users.noreply.github.com>2023-06-01 10:22:33 +0200
committerGitHub <noreply@github.com>2023-06-01 10:22:33 +0200
commit7d726e5d074371010ca5930c98a7a21428b5b49d (patch)
treea6b541dc44c9a5b0624c399c79fafc237c05388f /searchlib
parent4ac8668275756864c88b6f91c170075ea6e8f262 (diff)
Revert "switch to bitvector for level 0 visiting"
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp32
1 files changed, 2 insertions, 30 deletions
diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
index 748a747d515..e3fa3f1f9f3 100644
--- a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
@@ -1038,7 +1038,7 @@ HnswIndex<type>::count_reachable_nodes() const
visited[entry.nodeid] = true;
}
vespalib::steady_time doom = vespalib::steady_clock::now() + MAX_COUNT_DURATION;
- while (search_level > 0) {
+ while (search_level >= 0) {
for (uint32_t idx = 0; idx < found_links.size(); ++idx) {
if (vespalib::steady_clock::now() > doom) {
return {found_links.size(), false};
@@ -1057,35 +1057,7 @@ HnswIndex<type>::count_reachable_nodes() const
}
--search_level;
}
- uint32_t found_cnt = found_links.size();
- search::AllocatedBitVector visitNext(visited.size());
- for (uint32_t nodeid : found_links) {
- visitNext.setBit(nodeid);
- }
- bool runAnotherVisit = true;
- while (runAnotherVisit) {
- if (vespalib::steady_clock::now() > doom) {
- return {found_cnt, false};
- }
- runAnotherVisit = false;
- visitNext.foreach_truebit(
- [&] (uint32_t nodeid) {
- // note: search_level == 0
- auto neighbors = _graph.acquire_link_array(nodeid, 0);
- for (uint32_t neighbor : neighbors) {
- if (neighbor >= visited.size() || visited[neighbor]) {
- continue;
- }
- ++found_cnt;
- visited[neighbor] = true;
- visitNext.setBit(neighbor);
- runAnotherVisit = true;
- }
- visitNext.clearBit(nodeid);
- }
- );
- }
- return {found_cnt, true};
+ return {found_links.size(), true};
}
template class HnswIndex<HnswIndexType::SINGLE>;