-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Description
Lines 404 to 417 in e7345b8
| function setindex!(h::Dict{K,Any}, v, key::K) where K | |
| @nospecialize v | |
| index, sh = ht_keyindex2_shorthash!(h, key) | |
| if index > 0 | |
| h.age += 1 | |
| @inbounds h.keys[index] = key | |
| @inbounds h.vals[index] = v | |
| else | |
| @inbounds _setindex!(h, v, key, -index, sh) | |
| end | |
| return h | |
| end |
ht_keyindex2_shorthash!only returnsindex > 0` if
Line 326 in e7345b8
| if key === k || isequal(key, k) |
As isequal(x,y) implies hash(x) == hash(y) and the Dict docs say 'Keys are compared with isequal and hashed with hash', seems like it should be fine to skip the h.keys[index] = key.
Metadata
Metadata
Assignees
Labels
No labels