Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit d6123c3

Browse files
abelbraaksmanosami
authored andcommitted
Small improvement for String.length (dotnet#9469)
* Simplify and improve perf of String.length * Improve performance of String.map * Revert "Improve performance of String.map" * Turn String.length into a one-liner, fixes dotnet#9469 (comment)
1 parent 3eb4140 commit d6123c3

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/fsharp/FSharp.Core/string.fs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,4 @@ namespace Microsoft.FSharp.Core
103103
check 0
104104

105105
[<CompiledName("Length")>]
106-
let length (str:string) =
107-
if String.IsNullOrEmpty str then
108-
0
109-
else
110-
str.Length
106+
let length (str:string) = if isNull str then 0 else str.Length

0 commit comments

Comments
 (0)