From f38e37973c513d1748660275ccfbf261734fb977 Mon Sep 17 00:00:00 2001 From: Suryansh Gupta Date: Mon, 13 Jan 2025 19:13:27 +0530 Subject: [PATCH] Remove restriction of caching onlu 10 % nodes in disk search --- src/pq_flash_index.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pq_flash_index.cpp b/src/pq_flash_index.cpp index d9ad50617..f03c6514f 100644 --- a/src/pq_flash_index.cpp +++ b/src/pq_flash_index.cpp @@ -355,13 +355,12 @@ void PQFlashIndex::cache_bfs_levels(uint64_t num_nodes_to_cache, std: tsl::robin_set node_set; - // Do not cache more than 10% of the nodes in the index - uint64_t tenp_nodes = (uint64_t)(std::round(this->_num_points * 0.1)); - if (num_nodes_to_cache > tenp_nodes) + // If num_nodes_to_cache is more than total_nodes then reduce num_nodes_to_cache to total_nodes. + if (num_nodes_to_cache > this->_num_points) { - diskann::cout << "Reducing nodes to cache from: " << num_nodes_to_cache << " to: " << tenp_nodes - << "(10 percent of total nodes:" << this->_num_points << ")" << std::endl; - num_nodes_to_cache = tenp_nodes == 0 ? 1 : tenp_nodes; + diskann::cout << "Reducing nodes to cache from: " << num_nodes_to_cache + << " to total nodes:" << this->_num_points << std::endl; + num_nodes_to_cache = this->_num_points; } diskann::cout << "Caching " << num_nodes_to_cache << "..." << std::endl;