crichez / swift-cuckoo-collections

Cross-platform Swift dictionaries & sets that use a cuckoo hashing algorithm
Apache License 2.0
0 stars 0 forks source link

`CuckooSet` #1

Closed crichez closed 2 years ago

crichez commented 2 years ago

Objectives

This pull request introduces CuckooSet, a set with constant-time insertions, deletions and lookups that uses a cuckoo hashing algorithm. It exposes the same API as Swift's Set and should feature quicker operations with larger sets, with slightly worse performance in smaller sets.

Implementation

The set only conforms to ExpressibleByArrayLiteral and Sequence since indices are meaningless. The hash functions in use are FNV-1 and FNV-1a with a 64-bit digest. These are from the swift-fowler-noll-vo repository and are still in pre-release pending performance comparisons.

Tasks