Skip to content

Commit 79bb658

Browse files
perf: replace LINQ Select+ToList with for-loop in RandomSamplingAmortizedFacets.GetAllDims
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 392bf1f commit 79bb658

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/Examine.Lucene/Search/RandomSamplingAmortizedFacets.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,16 @@ public RandomSamplingAmortizedFacets(
2727
}
2828

2929
public override IList<LuceneFacetResult> GetAllDims(int topN)
30-
=> _innerFacets.GetAllDims(topN).Select(Amortize).ToList();
30+
{
31+
var allDims = _innerFacets.GetAllDims(topN);
32+
var result = new List<LuceneFacetResult>(allDims.Count);
33+
for (var i = 0; i < allDims.Count; i++)
34+
{
35+
result.Add(Amortize(allDims[i]));
36+
}
37+
38+
return result;
39+
}
3140

3241
public override float GetSpecificValue(string dim, params string[] path)
3342
{

0 commit comments

Comments
 (0)