mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 11:38:20 +00:00
Switch to double hashing.
For large k, standard hashing imposes an unnecessary overhead. By switchting to double hashing, we invoke the hash function code at most two times.
This commit is contained in:
parent
1d50874256
commit
673607f9a7
1 changed files with 2 additions and 2 deletions
|
@ -44,7 +44,7 @@ function bloomfilter_basic_init%(fp: double, capacity: count,
|
|||
size_t optimal_k = BasicBloomFilter::K(cells, capacity);
|
||||
size_t seed = Hasher::MakeSeed(name->Len() > 0 ? name->Bytes() : 0,
|
||||
name->Len());
|
||||
const Hasher* h = new DefaultHasher(optimal_k, seed);
|
||||
const Hasher* h = new DoubleHasher(optimal_k, seed);
|
||||
|
||||
return new BloomFilterVal(new BasicBloomFilter(h, cells));
|
||||
%}
|
||||
|
@ -84,7 +84,7 @@ function bloomfilter_basic_init2%(k: count, cells: count,
|
|||
|
||||
size_t seed = Hasher::MakeSeed(name->Len() > 0 ? name->Bytes() : 0,
|
||||
name->Len());
|
||||
const Hasher* h = new DefaultHasher(k, seed);
|
||||
const Hasher* h = new DoubleHasher(k, seed);
|
||||
|
||||
return new BloomFilterVal(new BasicBloomFilter(h, cells));
|
||||
%}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue