Skip to content

Commit

Permalink
Add AggressiveInlining to type checks in SearchValues<string> (dotnet…
Browse files Browse the repository at this point in the history
  • Loading branch information
MihaZupan authored Nov 12, 2024
1 parent 5d69e2d commit 13f093e
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ internal sealed class SingleStringSearchValuesThreeChars<TValueLength, TCaseSens
// With case-sensitive comparisons, we've therefore already confirmed the match.
// With case-insensitive comparisons, we've applied the CaseConversionMask to the input, so while the anchors likely matched, we can't be sure.
// An exception to that is if we know the value is composed of only ASCII letters, in which case masking the input can't produce false positives.
private static bool CanSkipAnchorMatchVerification =>
!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<string>? uniqueValues, string value) : base(uniqueValues)
{
Expand Down

0 comments on commit 13f093e

Please sign in to comment.