From 2359f3209fa6517452d87de03d732e00959e5f98 Mon Sep 17 00:00:00 2001 From: Matt Bauman Date: Tue, 27 Feb 2018 13:44:38 -0600 Subject: [PATCH] Optimize dataids(::AbstractArray) I was previously calling objectid -- I should have been using pointer_from_objref. The former is a hash, the latter is much quicker and easier to compute. --- base/abstractarray.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/abstractarray.jl b/base/abstractarray.jl index 2ca029d8b2d16..91f8ed6bd84f1 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -1146,7 +1146,7 @@ parts can specialize this method to return the concatenation of the `dataids` of their component parts. A typical definition for an array that wraps a parent is `Base.dataids(C::CustomArray) = dataids(C.parent)`. """ -dataids(A::AbstractArray) = (UInt(objectid(A)),) +dataids(A::AbstractArray) = (UInt(pointer_from_objref(A)),) dataids(A::Array) = (UInt(pointer(A)),) dataids(::AbstractRange) = () dataids(x) = ()