You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This should ideally also test for IReadOnlyList<T>, as IList<T> does not inherit from IReadOnlyList<T>, and an implementer of IReadOnlyList<T> is equally valid for the fast paths here.
The text was updated successfully, but these errors were encountered:
This should ideally also test for IReadOnlyList<T>, as IList<T> does not inherit from IReadOnlyList<T>, and an implementer of IReadOnlyList<T> is equally valid for the fast paths here.
I found quite a few complains or rejected attempts to optimize LINQ for IReadOnlyCollection:
#28651 - LINQ results implicit support for IReadOnlyCollection #27517 - Performance: Make constructor List(IEnumerable collection) know about IReadOnlyCollection #26679 - Linq ToDictionary() should presize for IReadOnlyCollection #14366 - System.Linq performance improvement suggestions (mentions IROC<>) #24793 - Respect IReadOnlyList in the BCL #23910 - Add optimized path for IReadOnlyCollection/IReadOnlyList in System.Linq #18714 - Consider checking for IReadOnlyCollection in Enumerable.ToArray #27516 - Performance of LINQ .Any() - type check to leverage .Count property? (mentions IROC) #27517 - Performance: Make constructor List(IEnumerable collection) know about IReadOnlyCollection dotnet/corefx#28472 - Check for IReadOnlyCollection #43001 - LINQ IEnumerable extension methods should add special case IReadOnlyCollection
In several places in System.Linq.Enumerable, it checks for a more performant path by testing if the source is
IList<T>
(for exampleruntime/src/libraries/System.Linq/src/System/Linq/Last.cs
Line 76 in 0f5b753
This should ideally also test for
IReadOnlyList<T>
, asIList<T>
does not inherit fromIReadOnlyList<T>
, and an implementer ofIReadOnlyList<T>
is equally valid for the fast paths here.The text was updated successfully, but these errors were encountered: