diff options
author | Stephen Toub <stoub@microsoft.com> | 2017-10-09 14:30:30 -0400 |
---|---|---|
committer | Stephen Toub <stoub@microsoft.com> | 2017-10-09 14:30:30 -0400 |
commit | dccf52a75e935276075d2aee1d1ec1338b84855c (patch) | |
tree | e97061a64e23bb98e1572758601d32060832d3ca /src | |
parent | 0ba964d19b84a690a451a61a38fa12c4ebf4f890 (diff) | |
download | coreclr-dccf52a75e935276075d2aee1d1ec1338b84855c.tar.gz coreclr-dccf52a75e935276075d2aee1d1ec1338b84855c.tar.bz2 coreclr-dccf52a75e935276075d2aee1d1ec1338b84855c.zip |
Undo unnecessary change from DateTime.Parse commit
This change shouldn't have been included in my DateTime.Parse span change. It was left-over from some local experimentation. The change doesn't hurt anything functionally, but it does undo a small optimization; I've not measured whether it's impactful or not, so I'm putting it back the way it was.
Diffstat (limited to 'src')
-rw-r--r-- | src/mscorlib/src/System/String.Comparison.cs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mscorlib/src/System/String.Comparison.cs b/src/mscorlib/src/System/String.Comparison.cs index 8e628d92ec..fd318b3d08 100644 --- a/src/mscorlib/src/System/String.Comparison.cs +++ b/src/mscorlib/src/System/String.Comparison.cs @@ -219,12 +219,20 @@ namespace System } } - private unsafe static int CompareOrdinalHelper(string strA, string strB) + private static unsafe int CompareOrdinalHelper(String strA, String strB) { + Debug.Assert(strA != null); + Debug.Assert(strB != null); + + // NOTE: This may be subject to change if eliminating the check + // in the callers makes them small enough to be inlined + Debug.Assert(strA._firstChar == strB._firstChar, + "For performance reasons, callers of this method should " + + "check/short-circuit beforehand if the first char is the same."); + int length = Math.Min(strA.Length, strB.Length); - fixed (char* ap = strA) - fixed (char* bp = strB) + fixed (char* ap = &strA._firstChar) fixed (char* bp = &strB._firstChar) { char* a = ap; char* b = bp; |