Skip to content

Commit ca6c54b

Browse files
keramsbaronfel
authored andcommitted
Remove string allocation (#9706)
1 parent 60a5659 commit ca6c54b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/fsharp/FSharp.Core/reflect.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ module internal Impl =
166166
let nm = minfo.Name
167167
// chop "get_" or "New" off the front
168168
let nm =
169-
if not (isListType typ) && not (isOptionType typ) then
170-
if nm.Length > 4 && nm.[0..3] = "get_" then nm.[4..]
171-
elif nm.Length > 3 && nm.[0..2] = "New" then nm.[3..]
169+
if not (isListType typ) && not (isOptionType typ) && nm.Length > 3 then
170+
if nm.StartsWith ("get_", StringComparison.Ordinal) then nm.[4..]
171+
elif nm.StartsWith ("New", StringComparison.Ordinal) then nm.[3..]
172172
else nm
173173
else nm
174174
Some (n, nm)

0 commit comments

Comments
 (0)