4 ms·
Oh I see, how many did you choose for the bucket numbers? ( I assumed pre-allocate was a capacity allocation rather than bucket parameter ) I'd recommend 8213
by eterm 4y ago
Oh I see, how many did you choose for the bucket numbers?
( I assumed pre-allocate was a capacity allocation rather than bucket parameter )
I'd recommend 82139 which is the closest prime above 82137 which is Sqrt(Pi/2 * 2^32) which is the expected number of items before a collision.
I'd also be interested to hear the performance under the hash function:
hash(x) = x
This is the CLR and JRE's prefered int32 hash. It's a poor hash for cryptographic purposes or wanting random bits but it has stellar performance for the most part.
- badsectoracula 4y agoI linked the source above. The bucket count is a bit highter than 82139... just 101473717 :-P. Changing it with 82139 does make it twice as slow though. I used 101473717 because that was the number i got from bucket_count() after running it with the default buckets. About hash(x)=x, that is interesting, i never thought to just use x itself as the hash :-P. The performance is actually a tiny bit better (~17%) for checking if a number is in the set.