Skip to content

Commit

Permalink
avoid jl_arrayunset in dicts with bitstypes; add some more @inbounds
Browse files Browse the repository at this point in the history
  • Loading branch information
chethega committed Nov 21, 2018
1 parent b87ab60 commit 6d94a87
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions base/dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ function getkey(h::Dict{K,V}, key, default) where V where K
end

function _pop!(h::Dict, index)
val = h.vals[index]
@inbounds val = h.vals[index]
_delete!(h, index)
return val
end
Expand Down Expand Up @@ -619,10 +619,10 @@ function pop!(h::Dict)
key => val
end

function _delete!(h::Dict, index)
h.slots[index] = 0x2
ccall(:jl_arrayunset, Cvoid, (Any, UInt), h.keys, index-1)
ccall(:jl_arrayunset, Cvoid, (Any, UInt), h.vals, index-1)
function _delete!(h::Dict{K,V}, index) where {K,V}
@inbounds h.slots[index] = 0x2
isbitstype(K) || ccall(:jl_arrayunset, Cvoid, (Any, UInt), h.keys, index-1)
isbitstype(V) || ccall(:jl_arrayunset, Cvoid, (Any, UInt), h.vals, index-1)
h.ndel += 1
h.count -= 1
h.age += 1
Expand Down

0 comments on commit 6d94a87

Please sign in to comment.