Do not use range adaptor to gather ranked matches
This ends up constructing RankedMatch twice, once when computing the number of elements then once when actually filling the vector.
This commit is contained in:
parent
4a1a3ee06e
commit
1cfe5273f3
|
@ -336,9 +336,12 @@ private:
|
||||||
Completions rank_candidates(StringView query)
|
Completions rank_candidates(StringView query)
|
||||||
{
|
{
|
||||||
UsedLetters query_letters = used_letters(query);
|
UsedLetters query_letters = used_letters(query);
|
||||||
auto matches = m_candidates | transform([&](const auto& c) { return RankedMatch{c.first, c.second, query, query_letters}; })
|
Vector<RankedMatch> matches;
|
||||||
| filter([](const auto& m) { return (bool)m; })
|
for (auto&& candidate : m_candidates)
|
||||||
| gather<Vector<RankedMatch>>();
|
{
|
||||||
|
if (RankedMatch m{candidate.first, candidate.second, query, query_letters})
|
||||||
|
matches.push_back(m);
|
||||||
|
}
|
||||||
|
|
||||||
constexpr size_t max_count = 100;
|
constexpr size_t max_count = 100;
|
||||||
CandidateList res;
|
CandidateList res;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user