From 247b9bc86e9ff75524ebfbd2e80779a661e02f96 Mon Sep 17 00:00:00 2001 From: Andrew Ayers Date: Fri, 24 Apr 2026 15:59:12 -0700 Subject: [PATCH] Add [NoInlining] to Marvin.ComputeHash32OrdinalIgnoreCase The inline budget increase from 20 to 22 in PR #118641 caused partial inlining of the Marvin OrdinalIgnoreCase hash computation. At budget 22, the JIT inlines ComputeHash32OrdinalIgnoreCase into callers but then lacks budget to fully inline the Block() calls, resulting in worse code layout and significant performance regressions (up to 32% on CredentialCache benchmarks). ComputeHash32 (the byte-based overload) already has [NoInlining] to prevent this exact problem. Apply the same treatment to the char-based ComputeHash32OrdinalIgnoreCase. Fix #118739 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../src/System/Marvin.OrdinalIgnoreCase.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Private.CoreLib/src/System/Marvin.OrdinalIgnoreCase.cs b/src/libraries/System.Private.CoreLib/src/System/Marvin.OrdinalIgnoreCase.cs index a9d793327e4f7a..72308f7432f700 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Marvin.OrdinalIgnoreCase.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Marvin.OrdinalIgnoreCase.cs @@ -15,6 +15,7 @@ internal static partial class Marvin /// Compute a Marvin OrdinalIgnoreCase hash and collapse it into a 32-bit hash. /// n.b. is specified as char count, not byte count. /// + [MethodImpl(MethodImplOptions.NoInlining)] public static int ComputeHash32OrdinalIgnoreCase(ref char data, int count, uint p0, uint p1) { uint ucount = (uint)count; // in chars