Mark XxHash64.Complete as noinline (#90142)
authorEgor Bogatov <egorbo@gmail.com>
Tue, 8 Aug 2023 13:16:10 +0000 (15:16 +0200)
committerGitHub <noreply@github.com>
Tue, 8 Aug 2023 13:16:10 +0000 (15:16 +0200)
src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash64.State.cs

index efd3215..9462928 100644 (file)
@@ -97,6 +97,10 @@ namespace System.IO.Hashing
                 return acc;
             }
 
+            // Inliner may decide to inline this method into HashToUInt64() with help of PGO and
+            // can run out of "time budget" producing non-inlined simple calls such as Span.Slice.
+            // TODO: Remove NoInlining when https://github.com/dotnet/runtime/issues/85531 is fixed.
+            [MethodImpl(MethodImplOptions.NoInlining)]
             internal readonly ulong Complete(long length, ReadOnlySpan<byte> remaining)
             {
                 ulong acc = _hadFullStripe ? Converge() : _smallAcc;