Skip to content

Commit 6bfe947

Browse files
authored
avoid jl_arrayunset in dicts with bitstypes; add some more @inbounds (#30113)
* avoid jl_arrayunset in dicts with bitstypes; add some more @inbounds * also skip jl_arrayunset for isbitsunion * amend typo
2 parents 67bba81 + d7198bf commit 6bfe947

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

base/dict.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ function getkey(h::Dict{K,V}, key, default) where V where K
571571
end
572572

573573
function _pop!(h::Dict, index)
574-
val = h.vals[index]
574+
@inbounds val = h.vals[index]
575575
_delete!(h, index)
576576
return val
577577
end
@@ -619,10 +619,10 @@ function pop!(h::Dict)
619619
key => val
620620
end
621621

622-
function _delete!(h::Dict, index)
623-
h.slots[index] = 0x2
624-
ccall(:jl_arrayunset, Cvoid, (Any, UInt), h.keys, index-1)
625-
ccall(:jl_arrayunset, Cvoid, (Any, UInt), h.vals, index-1)
622+
function _delete!(h::Dict{K,V}, index) where {K,V}
623+
@inbounds h.slots[index] = 0x2
624+
isbitstype(K) || isbitsunion(K) || ccall(:jl_arrayunset, Cvoid, (Any, UInt), h.keys, index-1)
625+
isbitstype(V) || isbitsunion(V) || ccall(:jl_arrayunset, Cvoid, (Any, UInt), h.vals, index-1)
626626
h.ndel += 1
627627
h.count -= 1
628628
h.age += 1

0 commit comments

Comments
 (0)