Closed
Description
The current SearchMemoryEvaluator
implementation is as follows.
public IEnumerable<T> Evaluate<T>(IEnumerable<T> query, ISpecification<T> specification)
{
foreach (var searchGroup in specification.SearchCriterias.GroupBy(x => x.SearchGroup))
{
query = query.Where(x => searchGroup.Any(c => c.SelectorFunc(x).Like(c.SearchTerm)));
}
return query;
}
This looks relatively simple, but there are a lot of hidden allocations. Moreover, the number of allocations is not constant, and it depends on the size of the input collection.
We need to implement a custom iterator and come up with an allocation-free GroupBy implementation. We may keep the search expressions sorted by search group, and then slice to get the groups.
Breaking Changes:
The SearchEvaluator
was renamed to SearchMemoryEvaluator
. It was causing unnecessary name collisions with EF plugin evaluators.
Metadata
Metadata
Assignees
Labels
No labels