perf(advanced-search): span-based leaf evaluator for EvaluateBoolean

Custom LeafEvaluator<TState> delegate takes the leaf as ReadOnlySpan<char>
(Func<> can't take a ref struct) and threads caller state through, so the
property-test recursion allocates neither a per-leaf string nor a capturing
closure per entity.
This commit is contained in:
Kamron Batman 2026-07-20 08:23:19 -07:00
parent b22a35e4ad
commit 3516aa6d85
3 changed files with 12 additions and 6 deletions

View file

@ -349,7 +349,7 @@ public class AdvancedSearchThreadWorker
}
private static bool EvaluateRecursive(IEntity entity, ReadOnlySpan<char> span) =>
AdvancedSearchUtilities.EvaluateBoolean(span, leaf => EvaluateSingleExpression(entity, leaf));
AdvancedSearchUtilities.EvaluateBoolean(span, entity, static (e, leaf) => EvaluateSingleExpression(e, leaf));
private static bool EvaluateSingleExpression(IEntity entity, ReadOnlySpan<char> expression)
{