feat: use less threads for short lists

This commit is contained in:
Michael Mandl 2024-03-20 16:52:08 +01:00
parent 7f18d0d6cc
commit 48283d0d76
Signed by: mandlm
GPG key ID: 4AA25D647AA54CC7

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_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;