Skip to content

Commit f9f3726

Browse files
vtjnashtkelman
authored andcommitted
make == type comparisions much cheaper and faster
ref #11425 (cherry picked from commit e529058) one piece from #15575, modified to not use @_pure_meta for release-0.4
1 parent 51d8a18 commit f9f3726

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

base/operators.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@ isless(x::AbstractFloat, y::AbstractFloat) = (!isnan(x) & isnan(y)) | (signbit(x
1919
isless(x::Real, y::AbstractFloat) = (!isnan(x) & isnan(y)) | (signbit(x) & !signbit(y)) | (x < y)
2020
isless(x::AbstractFloat, y::Real ) = (!isnan(x) & isnan(y)) | (signbit(x) & !signbit(y)) | (x < y)
2121

22-
=={T}(::Type{T}, ::Type{T}) = true # encourage more specialization on types (see #11425)
23-
==(T::Type, S::Type) = typeseq(T, S)
22+
function ==(T::Type, S::Type)
23+
typeseq(T, S)
24+
end
25+
function !=(T::Type, S::Type)
26+
!(T == S)
27+
end
2428

2529
## comparison fallbacks ##
2630

0 commit comments

Comments
 (0)