ref T loop vs Span<T> indexing in C#: why the span version is as fast or faster in .NET 10
On .NET 10 a plain for loop over span[i] bounded by span.Length compiles to a bounds-check-free, strength-reduced, down-counting loop. A hand-written Unsafe.Add(ref r, i) loop with an int index keeps a sign extension and an up-counting compare, and measured 2-5% slower. Benchmarks and JIT disassembly for arm64 and x64 on .NET 10.0.10.