Improve performance of Memory<T>.Span property getter (#20386)
authorLevi Broderick <GrabYourPitchforks@users.noreply.github.com>
Tue, 6 Nov 2018 19:02:16 +0000 (11:02 -0800)
committerGitHub <noreply@github.com>
Tue, 6 Nov 2018 19:02:16 +0000 (11:02 -0800)
commitef93a727984dbc5b8925a0c2d723be6580d20460
tree81795855e14a4ea83c56e97a286a98f1c3099baa
parent0dc37d16d734484b75e47cb243e347f5959a29bf
Improve performance of Memory<T>.Span property getter (#20386)

- We can use our knowledge of object representation in the runtime to speed up type checks.
- We leave the ref T and the length deconstructed until the very end, optimizing register usage.
- The Length property getter is once again just a simple field accessor with no bitwise logic.
src/System.Private.CoreLib/shared/System/Memory.cs
src/System.Private.CoreLib/shared/System/ReadOnlyMemory.cs
src/System.Private.CoreLib/shared/System/Runtime/InteropServices/MemoryMarshal.cs
src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs
tests/CoreFX/CoreFX.issues.json