diff options
author | Andy Ayers <andya@microsoft.com> | 2018-02-28 18:23:16 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2018-03-03 04:11:24 +0300 |
commit | dec1b08fa3065d259f5e2dc3a8c4ac3cd757854d (patch) | |
tree | e924752c8517b2558386ce27bd85bf193e2782f7 /src | |
parent | 5fed2df882442962e6791c06ebe3786643c04af4 (diff) |
Mark MemoryMarshal.Cast methods for aggressive inlining (#16654)
Inlining doesn't streamline the cast logic any, but it facilitates
caller struct promotion which can substantially boost perf.
See discussion in dotnet/corefx#27485.
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/System.Private.CoreLib/shared/System/Runtime/InteropServices/MemoryMarshal.Fast.cs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/MemoryMarshal.Fast.cs b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/MemoryMarshal.Fast.cs index 8a5bb7539..5d2a4447d 100644 --- a/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/MemoryMarshal.Fast.cs +++ b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/MemoryMarshal.Fast.cs @@ -50,6 +50,7 @@ namespace System.Runtime.InteropServices /// <exception cref="System.ArgumentException"> /// Thrown when <typeparamref name="TFrom"/> or <typeparamref name="TTo"/> contains pointers. /// </exception> + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Span<TTo> Cast<TFrom, TTo>(Span<TFrom> source) where TFrom : struct where TTo : struct @@ -104,6 +105,7 @@ namespace System.Runtime.InteropServices /// <exception cref="System.ArgumentException"> /// Thrown when <typeparamref name="TFrom"/> or <typeparamref name="TTo"/> contains pointers. /// </exception> + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ReadOnlySpan<TTo> Cast<TFrom, TTo>(ReadOnlySpan<TFrom> source) where TFrom : struct where TTo : struct |