Skip to content

Commit

Permalink
Optimize dataids(::AbstractArray)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mbauman committed Feb 27, 2018
1 parent b1b5066 commit 2359f32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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) = ()
Expand Down

0 comments on commit 2359f32

Please sign in to comment.