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
  • Loading branch information
vtjnash committed Apr 6, 2016
1 parent 68ad5d1 commit 5d61029
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ 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)
@_pure_meta
typeseq(T, S)
end
function !==(T::Type, S::Type)
@_pure_meta
!(T == S)
end

## comparison fallbacks ##

Expand Down

0 comments on commit 5d61029

Please sign in to comment.