Skip to content

Commit

Permalink
Merge pull request #16855 from ScottPJones/spj/fasteqstr
Browse files Browse the repository at this point in the history
Improve performance of == for String even further
  • Loading branch information
JeffBezanson authored Jun 10, 2016
2 parents b08bbba + 661b54a commit 4f65737
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion base/strings/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ isless(a::AbstractString, b::AbstractString) = cmp(a,b) < 0
cmp(a::String, b::String) = lexcmp(a.data, b.data)
cmp(a::Symbol, b::Symbol) = Int(sign(ccall(:strcmp, Int32, (Cstring, Cstring), a, b)))

==(a::String, b::String) = length(a.data) == length(b.data) && cmp(a,b) == 0
==(a::String, b::String) =
(len = length(a.data)) == length(b.data) &&
ccall(:memcmp, Int32, (Ptr{UInt8}, Ptr{UInt8}, UInt), a.data, b.data, len) == 0
isless(a::Symbol, b::Symbol) = cmp(a,b) < 0

## Generic validation functions ##
Expand Down

2 comments on commit 4f65737

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - successfully executed benchmarks. A full report can be found here. cc @jrevels

Please sign in to comment.