rust-cuckoofilter icon indicating copy to clipboard operation
rust-cuckoofilter copied to clipboard

Increase size if needed

Open seiflotfy opened this issue 8 years ago • 4 comments

After discussing with Bin Fan (original author of the paper): he suggested the following.

To expand a cuckoo hash table in a relatively cheap way, with the assumption that doubling the table size each time is fine:

(1) Copy the old hashtable twice into a new hashtable of 2x size, so the first half and the second half of the new bigger hashtable will be identical to the old one respectively. Now each item appears twice in the new hashtable---one in the top half and one in the bottom half.

(2) For each item in the old table, check the legitimate location of this item in the new table: if it should stay in the first half, delete the copy in the second half and vice versa.

After all items in the old table are checked, the new table contains the all items in 2x buckets, without performing expensive cuckoo insertion process.

seiflotfy avatar Jul 17 '15 07:07 seiflotfy