-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Conversation
Anything that can be one can be the other, so merge the two interfaces. Add ToList support to OrderedPartition.
Optimisation of Skip() for IList sources from dotnet#4551 fits with optimisations of Skip() and Take() for other sources from dotnet#2401. Combine the approaches, extending how the result of Skip() on a list handles subsequent operations.
The creation of SelectListIterator allows for partitioning to be used with the list-based select iterators, improving some subsequent operations on them.
Set never has Add called after Remove. Remove paths and fields only necessary in that case. Add debug-only check on this assumption, so any new uses that break this assumption are flagged to the developer.
With the changes to Set it's now easy to give these methods and optimised ToArray and ToList().
3608a6e
to
68d5036
Compare
Improve performance of Reverse().ToArray() and Reverse().ToList().
Also added IIListProvider support to ReverseIterator. Not clear why I didn't do that before. |
With an IPartition-implementing result for Select, the advantages of IPartition results can carry through to results. In particular the sequence .OrderBy(…).Select(…).Skip(pageOffset).Take(pageSize) can pass through the partial-sorting capability.
Further: Have With an In particular the sequence Introducing the |
This has grown legs. Would it be handier to consider the first few commits first, and then submit those that build on them after that? |
Thanks, @JonHanna. Yeah, I think it'd probably easier if it could be broken apart a bit, especially since GitHub isn't showing a diff view for the src changes to Enumerable.cs. |
Well now that we seem to have a positive decision on #2363, the thing at the very start of the list should be handling that, which you're on, so I'm going to close this and wait until that is in to look at this again. |
A few different optimisations to Linq added recently can be usefully combined with each other.
Combine
IArrayProvider
andIListProvider
Anything that can be one can be the other, so merge the two interfaces.
Add
ToList
support toOrderedPartition
.Have IList optimised result of Skip() partitionable.
Optimisation of
Skip()
forIList<T>
sources from #4551 fits with optimisations ofSkip()
andTake()
for other sources from #2401.Combine the approaches, extending how the result of
Skip()
on a list handles subsequent operations.Use partitioning on list-based select iterators.
The creation of
SelectListIterator
above allows for partitioning to be used with the list-basedSelect()
iterators, improving some subsequent operations on them.Remove unused paths in
Set
.Set
never hasAdd
called afterRemove
. Remove paths and fields only necessary in that case.Add debug-only check on this assumption, so any new uses that break this assumption are flagged to the developer.
Implement
IIListProvider
onDistinct()
andUnion()
.With those changes to
Set
it's now easy to give these methods an optimisedToArray
andToList()
.Tests of
IIListProvider
on emptyGroupBy
results.Noticed in the process of the above that this case isn't covered by tests though it does have very slightly different behaviour.