Guys, System.Buffers.Slice is so slow, it's supposed to interop with high performance System.IO.Pipelines #94629
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There are potentially things that could be done to improve that for the fast path, but you probably want to be using something like |
Beta Was this translation helpful? Give feedback.
ROSequence
tracks a sequence, which can possibly be many segments, and so slicing arbitrary buffers out of it can be quite expensive and is not trivial to inline. In the worst case, it ends up having to walk through many segments to find the relevant start (effectively walking a linked list) and then continue walking until it finds the end.There are potentially things that could be done to improve that for the fast path, but you probably want to be using something like
SequenceReader
, which helps offset the costs (particularly when doing sequential reading)CC. @GrabYourPitchforks