Skip to content

Commit 48fe637

Browse files
authored
Fix regression in IsPrefix / IsSuffix benchmarks (#61935)
Mark EndsWith and StartsWith as NoInlining
1 parent 1997bee commit 48fe637

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/libraries/Common/src/Interop/Interop.Collation.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Globalization;
6+
using System.Runtime.CompilerServices;
67
using System.Runtime.InteropServices;
78

89
internal static partial class Interop
@@ -25,10 +26,12 @@ internal static partial class Globalization
2526
internal static unsafe partial int LastIndexOf(IntPtr sortHandle, char* target, int cwTargetLength, char* pSource, int cwSourceLength, CompareOptions options, int* matchLengthPtr);
2627

2728
[GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_StartsWith", CharSet = CharSet.Unicode)]
29+
[MethodImpl(MethodImplOptions.NoInlining)]
2830
[return: MarshalAs(UnmanagedType.Bool)]
2931
internal static unsafe partial bool StartsWith(IntPtr sortHandle, char* target, int cwTargetLength, char* source, int cwSourceLength, CompareOptions options, int* matchedLength);
3032

3133
[GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_EndsWith", CharSet = CharSet.Unicode)]
34+
[MethodImpl(MethodImplOptions.NoInlining)]
3235
[return: MarshalAs(UnmanagedType.Bool)]
3336
internal static unsafe partial bool EndsWith(IntPtr sortHandle, char* target, int cwTargetLength, char* source, int cwSourceLength, CompareOptions options, int* matchedLength);
3437

0 commit comments

Comments
 (0)