Open
Description
unordered-containers/Data/HashMap/Internal.hs
Lines 2197 to 2202 in 352591a
Once we've identified an element of ary2
to correspond to an element of ary1
, it would be nice if we wouldn't check the same element again against the subsequent elements of ary1
.
@treeowl had a neat idea for that in #282 (comment):
I wouldn't record indices. But we could
thaw
one of the arrays and play mutation games. Say we have1 2 3 4
and we search for
3
. Then we can mutate the array toundefined 2 1 4
That is, swap the
3
to the front and replace it withundefined
. Then start the next scan in the second slot.