Blog139.7K views3,638 votes0 replies4,838 following
ReadOnlySpan<T> in Practice: Slicing Strings Without the Garbage
Substring() copies data to the heap. ReadOnlySpan<T> gives you a view into the original buffer instead. Here is how that changes parsing loops, where it stops working, and how to verify the difference.