Skip to content

Conversation

Ebola-Chan-bot
Copy link
Contributor

@Ebola-Chan-bot Ebola-Chan-bot commented Jan 19, 2023

Support [ReadOnly]Span, because unlike arrays, it cannot be cast to IEnumerable without an extra copy. Memory has a Span property that does not copy so no need to add a version for it. Note that Span only support .Net Core 2.1 and later versions on this line. Framework, Standard (except the rarely used Standard 2.1) and UWP don't support Span.

Extend arrays to I[ReadOnly]List. For arrays this interface behaves identically, but it can also support other implementations without an extra copy. For example, SelectPermutationInplace could only perform on the full range of an array - it was not possible to permute only a segment of the array. Now you can create an ArraySegment, which implements IList, and pass it to SelectPermutationInplace. Only the range specified when creating the ArraySegment will be permuted. You can also pass ArraySegment to other similar functions. This is more efficient than Skip-Take in that it does not copy.

Add an InPlace version of SelectVariation to save a copy if the caller allows modifications on the input data.

Support [ReadOnly]Span, because unlike arrays, it cannot be cast to IEnumerable without an extra copy.
Extend arrays to I[ReadOnly]List. For arrays this interface behaves identically, but it can also support other implementations without an extra copy.
Add an InPlace version of SelectVariation to save a copy if the caller allows modifications on the input data.
@Ebola-Chan-bot Ebola-Chan-bot changed the title Copy-avoidance optimizations Copy-avoidance optimizations on Combinatorics Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant