diff options
| author | chenzizhan <[email protected]> | 2024-10-14 14:11:02 +0800 |
|---|---|---|
| committer | chenzizhan <[email protected]> | 2024-10-14 14:28:59 +0800 |
| commit | f0a4d5ae3c6f0c767ff11c5d9aa381badf83e4bc (patch) | |
| tree | 2db625ef3474b14d6afa0453019270a370b9d358 /src/cells | |
| parent | 652bccee18d8555232dc1679cfbe7bf677181c77 (diff) | |
performance: enable uthash bloom filter
Diffstat (limited to 'src/cells')
| -rw-r--r-- | src/cells/heavy_keeper.c | 3 | ||||
| -rw-r--r-- | src/cells/spread_sketch.c | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/cells/heavy_keeper.c b/src/cells/heavy_keeper.c index eff0c78..ee21c2a 100644 --- a/src/cells/heavy_keeper.c +++ b/src/cells/heavy_keeper.c @@ -19,6 +19,9 @@ hashv = XXH3_64bits(keyptr, keylen); \ } while (0) +#define HASH_BLOOM 16 // https://troydhanson.github.io/uthash/userguide.html#_bloom_filter_faster_misses +// Reasonable values for the size of the Bloom filter are 16-32 bits. Since heavy keeper often has items less than 1000, 16 bits is fairly enough. + #include "uthash.h" #include "exdata.h" diff --git a/src/cells/spread_sketch.c b/src/cells/spread_sketch.c index c2dee92..8e98f80 100644 --- a/src/cells/spread_sketch.c +++ b/src/cells/spread_sketch.c @@ -6,6 +6,15 @@ #include <assert.h> #include "xxhash/xxhash.h" + +// XXHASH is faster for long string keys +#define HASH_FUNCTION(keyptr, keylen, hashv) \ + do { \ + hashv = XXH3_64bits(keyptr, keylen); \ + } while (0) +#define HASH_BLOOM 16 // https://troydhanson.github.io/uthash/userguide.html#_bloom_filter_faster_misses +// Reasonable values for the size of the Bloom filter are 16-32 bits. Since cube often has items less than 1000, 16 bits is fairly enough. + #include "uthash.h" #include "spread_sketch.h" |
