Log times for operations.

This commit is contained in:
Kishore Nallan 2021-11-19 19:32:00 +05:30
parent 774f3d3ce3
commit d2798ac00b
2 changed files with 12 additions and 3 deletions

View File

@ -1024,6 +1024,8 @@ int art_topk_iter(const art_node *root, token_ordering token_order, size_t max_r
}
}
LOG(INFO) << "leaf results.size: " << results.size();
printf("OUTSIDE art_topk_iter: results size: %d\n", results.size());
return 0;
}

View File

@ -1212,7 +1212,7 @@ void Index::search_candidates(const uint8_t & field_id, bool field_is_array,
void Index::do_filtering(uint32_t*& filter_ids, uint32_t& filter_ids_length,
const std::vector<filter>& filters,
const bool enable_short_circuit) const {
//auto begin = std::chrono::high_resolution_clock::now();
auto begin = std::chrono::high_resolution_clock::now();
for(size_t i = 0; i < filters.size(); i++) {
const filter & a_filter = filters[i];
@ -1552,10 +1552,10 @@ void Index::do_filtering(uint32_t*& filter_ids, uint32_t& filter_ids_length,
}
}
/*long long int timeMillis =
long long int timeMillis =
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - begin).count();
LOG(INFO) << "Time taken for filtering: " << timeMillis << "ms";*/
LOG(INFO) << "Time taken for filtering: " << timeMillis << "ms";
}
@ -2881,11 +2881,18 @@ void Index::search_field(const uint8_t & field_id,
// prefix should apply only for last token
const size_t token_len = prefix_search ? (int) token.length() : (int) token.length() + 1;
auto begin = std::chrono::high_resolution_clock::now();
// need less candidates for filtered searches since we already only pick tokens with results
art_fuzzy_search(search_index.at(field_name), (const unsigned char *) token.c_str(), token_len,
costs[token_index], costs[token_index], num_fuzzy_candidates, token_order, prefix_search,
filter_ids, filter_ids_length, leaves, unique_tokens);
auto timeMillis = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::high_resolution_clock::now() - begin).count();
LOG(INFO) << "Time taken for fuzzy search: " << timeMillis << "ms";
if(!leaves.empty()) {
token_cost_cache.emplace(token_cost_hash, leaves);
for(auto leaf: leaves) {