From f508def4d3dff2e98e2c776926ba66368ca15b27 Mon Sep 17 00:00:00 2001 From: kerams Date: Fri, 17 Jul 2020 17:44:22 +0200 Subject: [PATCH] Remove string allocation --- src/fsharp/FSharp.Core/reflect.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fsharp/FSharp.Core/reflect.fs b/src/fsharp/FSharp.Core/reflect.fs index 3f7c459be64..d18a0bf16e0 100644 --- a/src/fsharp/FSharp.Core/reflect.fs +++ b/src/fsharp/FSharp.Core/reflect.fs @@ -166,9 +166,9 @@ module internal Impl = let nm = minfo.Name // chop "get_" or "New" off the front let nm = - if not (isListType typ) && not (isOptionType typ) then - if nm.Length > 4 && nm.[0..3] = "get_" then nm.[4..] - elif nm.Length > 3 && nm.[0..2] = "New" then nm.[3..] + if not (isListType typ) && not (isOptionType typ) && nm.Length > 3 then + if nm.StartsWith ("get_", StringComparison.Ordinal) then nm.[4..] + elif nm.StartsWith ("New", StringComparison.Ordinal) then nm.[3..] else nm else nm Some (n, nm)