File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/EventLogExpert.UI/Services Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,16 @@ public IReadOnlyList<DisplayEventModel> GetFilteredEvents(
4040 return events as IReadOnlyList < DisplayEventModel > ?? [ .. events ] ;
4141 }
4242
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+
4353 return events . AsParallel ( )
4454 . Where ( e => e . FilterByDate ( eventFilter . DateFilter )
4555 . Filter ( eventFilter . Filters , IsXmlEnabled ) )
You can’t perform that action at this time.
0 commit comments