feat: use less threads for short lists
This commit is contained in:
parent
7f18d0d6cc
commit
48283d0d76
1 changed files with 2 additions and 1 deletions
|
@ -22,7 +22,8 @@ GroupedFinder::find_prefix(std::string_view search_term) const {
|
|||
const auto word_list = group->second;
|
||||
const auto word_list_size = word_list.size();
|
||||
|
||||
const auto thread_count = std::thread::hardware_concurrency();
|
||||
const auto thread_count =
|
||||
std::min<size_t>(std::thread::hardware_concurrency(), word_list_size);
|
||||
|
||||
forward_list<const string *> matching_words;
|
||||
mutex matching_words_mutex;
|
||||
|
|
Loading…
Reference in a new issue