From 18d1696e6a505fedc30dba2a681d0f4e9f9309dc Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Mon, 4 Apr 2016 20:45:24 -0400 Subject: [PATCH] make == type comparisions much cheaper and faster ref #11425 --- base/operators.jl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/base/operators.jl b/base/operators.jl index cbe42c6c3339b..8129af377f5e4 100644 --- a/base/operators.jl +++ b/base/operators.jl @@ -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 ##