Skip to content

Commit e3e5617

Browse files
abelbraaksmabaronfel
authored andcommitted
Small improvement for String.length (#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/fsharp#9469 (comment)
1 parent 7b29b0f commit e3e5617

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)