> We may need to iterate all visited sockets again in this bucket if all > unvisited sockets disappear from the previous iteration. If the next socket disappears between iterator stop and start, the outer loop would need to keep going until it finds a socket from last time that still exists. In most cases, it seems unlikely that the next socket will disappear between iterator reads, so in general the outer loop would only need to iterate once; the common case should perform the same as before with the offset approach. The worst case indeed would be if all the sockets disappear between reads. Then you'd have to scan through all items in the bucket n_cookies times. Again though, this is hopefully a rare case. > When the number of the unvisited sockets is small like 1, the duplicated > records will not be rare and rather more often than before ? Sorry if I'm missing something, but what's the relationship between the number of unvisited sockets and rarity of duplicated records? -Jordan