Skip to content

Commit

Permalink
make == type comparisions much cheaper and faster
Browse files Browse the repository at this point in the history
ref #11425

(cherry picked from commit e529058)
one piece from #15575, modified to not use @_pure_meta for release-0.4
  • Loading branch information
vtjnash authored and tkelman committed Jun 17, 2016
1 parent 51d8a18 commit f9f3726
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ isless(x::AbstractFloat, y::AbstractFloat) = (!isnan(x) & isnan(y)) | (signbit(x
isless(x::Real, y::AbstractFloat) = (!isnan(x) & isnan(y)) | (signbit(x) & !signbit(y)) | (x < y)
isless(x::AbstractFloat, y::Real ) = (!isnan(x) & isnan(y)) | (signbit(x) & !signbit(y)) | (x < y)

=={T}(::Type{T}, ::Type{T}) = true # encourage more specialization on types (see #11425)
==(T::Type, S::Type) = typeseq(T, S)
function ==(T::Type, S::Type)
typeseq(T, S)
end
function !=(T::Type, S::Type)
!(T == S)
end

## comparison fallbacks ##

Expand Down

2 comments on commit f9f3726

@tkelman
Copy link
Contributor

Choose a reason for hiding this comment

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

@nanosoldier runbenchmarks(ALL, vs="@2ac304dfba75fad148d4070ef4f8a2e400c305bb")

@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 - possible performance regressions were detected. A full report can be found here. cc @jrevels

Please sign in to comment.