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
Not sure if it is there already, but Split will be a great addition to Span/Memory, especially those related to char or byte.
Currently, String.Split creates multiple copies of sub-strings in an array. I can remember many times that I ended up rolling my own Split with IndexOf just to avoid creating large number of one-time strings in tight loops.
Adding Split to Span and Memory can alleviate all this, especially in common situations where:
A string is split into multiple lines via \n
Each line is split into multiple fields via white-space to extract a command and parameters
Each command is processed individually
Both dotnet/corefx#1 and dotnet/corefx#2 above can be replaced by Span.Split which creates a simple array of a value type.
A further enhancement is to have Span.Split return a Span<Span<char>> to avoid creating the array.
The text was updated successfully, but these errors were encountered:
Not sure if it is there already, but
Split
will be a great addition toSpan
/Memory
, especially those related tochar
orbyte
.Currently,
String.Split
creates multiple copies of sub-strings in an array. I can remember many times that I ended up rolling my ownSplit
withIndexOf
just to avoid creating large number of one-time strings in tight loops.Adding
Split
toSpan
andMemory
can alleviate all this, especially in common situations where:string
is split into multiple lines via\n
Both dotnet/corefx#1 and dotnet/corefx#2 above can be replaced by
Span.Split
which creates a simple array of a value type.A further enhancement is to have
Span.Split
return aSpan<Span<char>>
to avoid creating the array.The text was updated successfully, but these errors were encountered: