public class CuckooUtils extends Object
Constructor and Description |
---|
CuckooUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
altIndex(int index,
int tag,
int numBuckets)
Compute the alternative index on given hash value and tag.
|
static int |
indexHash(int hv,
int numBuckets)
Computes the bucket index on given hash value.
|
static int |
optimalBitsPerTag(double fpp,
double loadFactor)
Compute the number of bits of each tag on given fpp.
|
static long |
optimalBuckets(long expectedInsertions,
double loadFactor,
int tagsPerBucket)
Compute the number of buckets using the expected number of insertions, the load factor, and the
number of tags per bucket.
|
static int |
tagHash(int hv,
int bitsPerTag)
Compute the fingerprint on given hash value.
|
public static int indexHash(int hv, int numBuckets)
hv
- the hash valuenumBuckets
- the number of bucketspublic static int altIndex(int index, int tag, int numBuckets)
index
- the bucket indextag
- the fingerprintnumBuckets
- the number of bucketspublic static int tagHash(int hv, int bitsPerTag)
hv
- the hash valuebitsPerTag
- the number of bits each tag haspublic static int optimalBitsPerTag(double fpp, double loadFactor)
fpp
- the false positive probabilityloadFactor
- the load factorpublic static long optimalBuckets(long expectedInsertions, double loadFactor, int tagsPerBucket)
expectedInsertions
- the expected number of unique itemsloadFactor
- the load factortagsPerBucket
- the number of slots per bucket hasCopyright © 2023. All Rights Reserved.