From 6e90bfc9bc350c50ccb64f298ca65d48d00fb795 Mon Sep 17 00:00:00 2001 From: Seebs Date: Thu, 31 Mar 2022 12:14:17 -0500 Subject: [PATCH] return early rather than just evaluating a rejection The intent of these lines was "if there's no filter, return immediately rather than doing operations". But actually we didn't write that, so we were calling intersectionCallback on empty filters, which didn't matter since it failed out quickly, but it's still a waste of effort. Except we shouldn't get to these anyway because ConsiderKey already correctly rejected these cases. I think. But still. --- roaring/filter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roaring/filter.go b/roaring/filter.go index 4687844b7..dbb6ba00d 100644 --- a/roaring/filter.go +++ b/roaring/filter.go @@ -625,7 +625,7 @@ func (b *BitmapBitmapFilter) ConsiderData(key FilterKey, data *Container) Filter base := uint64(key << 16) filter := b.containers[pos] if filter == nil { - key.RejectUntilOffset(b.nextOffsets[pos]) + return key.RejectUntilOffset(b.nextOffsets[pos]) } var lastErr error matched := false @@ -1040,7 +1040,7 @@ func (b *BitmapBSICountFilter) ConsiderData(key FilterKey, data *Container) Filt pos := key & keyMask filter := b.containers[pos] if filter == nil { - key.RejectUntilOffset(b.nextOffsets[pos]) + return key.RejectUntilOffset(b.nextOffsets[pos]) } row := uint64(key >> rowExponent) // row count within the fragment // How do we translate the filter and existence bit into actionable things?