feat: use less threads for short lists

main
mandlm 2024-03-20 16:52:08 +01:00
parent 7f18d0d6cc
commit 48283d0d76
Signed by: mandlm
GPG Key ID: 4AA25D647AA54CC7
1 changed files with 2 additions and 1 deletions

View File

@ -22,7 +22,8 @@ GroupedFinder::find_prefix(std::string_view search_term) const {
const auto word_list = group->second; const auto word_list = group->second;
const auto word_list_size = word_list.size(); 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; forward_list<const string *> matching_words;
mutex matching_words_mutex; mutex matching_words_mutex;