From 6d94a87906675510f99d54d4b5ab3cc06ca924fa Mon Sep 17 00:00:00 2001 From: chethega Date: Wed, 21 Nov 2018 20:27:20 +0100 Subject: [PATCH] avoid jl_arrayunset in dicts with bitstypes; add some more @inbounds --- base/dict.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/base/dict.jl b/base/dict.jl index 41b36eb5f65fc..44d8dfbb8efb1 100644 --- a/base/dict.jl +++ b/base/dict.jl @@ -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 @@ -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