From 13f093eced091b14f4723448392de4c3d517da48 Mon Sep 17 00:00:00 2001 From: Miha Zupan Date: Tue, 12 Nov 2024 22:08:37 +0100 Subject: [PATCH] Add AggressiveInlining to type checks in SearchValues (#109737) --- .../Strings/SingleStringSearchValuesThreeChars.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/SearchValues/Strings/SingleStringSearchValuesThreeChars.cs b/src/libraries/System.Private.CoreLib/src/System/SearchValues/Strings/SingleStringSearchValuesThreeChars.cs index 85efea2aad231..429e690f49a91 100644 --- a/src/libraries/System.Private.CoreLib/src/System/SearchValues/Strings/SingleStringSearchValuesThreeChars.cs +++ b/src/libraries/System.Private.CoreLib/src/System/SearchValues/Strings/SingleStringSearchValuesThreeChars.cs @@ -35,9 +35,13 @@ internal sealed class SingleStringSearchValuesThreeChars - !TValueLength.AtLeast4Chars && - (typeof(TCaseSensitivity) == typeof(CaseSensitive) || typeof(TCaseSensitivity) == typeof(CaseInsensitiveAsciiLetters)); + private static bool CanSkipAnchorMatchVerification + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => + !TValueLength.AtLeast4Chars && + (typeof(TCaseSensitivity) == typeof(CaseSensitive) || typeof(TCaseSensitivity) == typeof(CaseInsensitiveAsciiLetters)); + } public SingleStringSearchValuesThreeChars(HashSet? uniqueValues, string value) : base(uniqueValues) {