> (Span<T> is) at the heart of most performance-related improvements in .NET Core 2.1. Since it allows managing buffers in a more efficient way, it can help in reducing allocations and copying. We consider Span to be a very fundamental type as it requires runtime and compiler support in order to be fully leveraged.
Small struct that is declared as
public readonly ref struct Span<T>
{
private readonly ref T _pointer;
private readonly int _length;
...
}
which is exactly what I am using in Sciter (https://sciter.com) for 10+ years: template <typename T>
struct slice {
const T* start;
unsigned int length;
...
}
https://github.com/c-smile/sciter-sdk/blob/master/include/au...Such small thing definitely speed ups many areas and surprisingly quite a lot, parsing in particular.
Nothing new under the Sun, eh?