From 74c6b9f54c0da3792d6060082e772ddd6f1f0093 Mon Sep 17 00:00:00 2001 From: Matthias Vallentin Date: Wed, 7 Nov 2018 13:11:15 -0800 Subject: [PATCH] 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. --- src/probabilistic/bloom-filter.bif | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/probabilistic/bloom-filter.bif b/src/probabilistic/bloom-filter.bif index 46ec4699a0..9af2ae0d33 100644 --- a/src/probabilistic/bloom-filter.bif +++ b/src/probabilistic/bloom-filter.bif @@ -173,9 +173,6 @@ function bloomfilter_lookup%(bf: opaque of bloomfilter, x: any%): count %{ const BloomFilterVal* bfv = static_cast(bf); - if ( bfv->Empty() ) - return new Val(0, TYPE_COUNT); - if ( ! bfv->Type() ) reporter->Error("cannot perform lookup on untyped Bloom filter");