We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f23bf69 commit 2dbdc03Copy full SHA for 2dbdc03
1 file changed
src/EventLogExpert.UI/Services/FilterService.cs
@@ -40,6 +40,16 @@ public IReadOnlyList<DisplayEventModel> GetFilteredEvents(
40
return events as IReadOnlyList<DisplayEventModel> ?? [.. events];
41
}
42
43
+ // For small collections, PLINQ's thread scheduling overhead exceeds the
44
+ // parallelism benefit. Use sequential filtering below the threshold.
45
+ if (events is IReadOnlyCollection<DisplayEventModel> { Count: < 10_000 } collection)
46
+ {
47
+ return collection
48
+ .Where(e => e.FilterByDate(eventFilter.DateFilter)
49
+ .Filter(eventFilter.Filters, IsXmlEnabled))
50
+ .ToList();
51
+ }
52
+
53
return events.AsParallel()
54
.Where(e => e.FilterByDate(eventFilter.DateFilter)
55
.Filter(eventFilter.Filters, IsXmlEnabled))
0 commit comments