Remove unnessary check

The call to Empty() was originally meant as an optimization in the
lookup phase. However, the performance implications are substantial:
this check operates in O(f(m/8)) where m is the number of bits in the
Bloom filters and f a function that looks for the first non-empty block
of bits.

As the Bloom filter fills up, the check for Empty() becomes no longer
negligible and can lead to serious performance degradations when Bloom
filters are used frequently.
This commit is contained in:
Matthias Vallentin 2018-11-07 13:11:15 -08:00
parent c1f02aaa61
commit 74c6b9f54c

View file

@ -173,9 +173,6 @@ function bloomfilter_lookup%(bf: opaque of bloomfilter, x: any%): count
%{ %{
const BloomFilterVal* bfv = static_cast<const BloomFilterVal*>(bf); const BloomFilterVal* bfv = static_cast<const BloomFilterVal*>(bf);
if ( bfv->Empty() )
return new Val(0, TYPE_COUNT);
if ( ! bfv->Type() ) if ( ! bfv->Type() )
reporter->Error("cannot perform lookup on untyped Bloom filter"); reporter->Error("cannot perform lookup on untyped Bloom filter");