From f1cdc93b8bbfa3833b9c600ffc05a9d9c1ac5618 Mon Sep 17 00:00:00 2001 From: Glen Hertz Date: Sat, 26 Oct 2013 21:51:43 -0400 Subject: [PATCH] RFC: Immediately return true for equality checks if is(A,B) Perhaps I'm missing something but why not immediately return true from these checks if the two objects are identical? If this is valid there are likely other places this could happen too...but I thought I would first check. Thanks, Glen --- base/abstractarray.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/base/abstractarray.jl b/base/abstractarray.jl index 6b8c2c783f99f..983b089a72ab6 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -1031,6 +1031,7 @@ end ## Reductions and scans ## function isequal(A::AbstractArray, B::AbstractArray) + if A === B return true end if size(A) != size(B) return false end @@ -1054,6 +1055,7 @@ function lexcmp(A::AbstractArray, B::AbstractArray) end function (==)(A::AbstractArray, B::AbstractArray) + if A === B return true end if size(A) != size(B) return false end