Skip to content

Commit 0a66970

Browse files
committed
make == type comparisions much cheaper and faster
ref #11425
1 parent e286824 commit 0a66970

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

base/operators.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ 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+
@_pure_meta
24+
typeseq(T, S)
25+
end
26+
function !==(T::Type, S::Type)
27+
@_pure_meta
28+
!(T == S)
29+
end
2430

2531
## comparison fallbacks ##
2632

0 commit comments

Comments
 (0)