From 12d45415bb6986c6fd3b689fb15d21d5e892238f Mon Sep 17 00:00:00 2001 From: Richard Artoul Date: Thu, 29 Nov 2018 17:29:32 -0500 Subject: [PATCH] more refactoring and micro optimizations --- roaring/roaring.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/roaring/roaring.go b/roaring/roaring.go index 7b382ec6f..575515743 100644 --- a/roaring/roaring.go +++ b/roaring/roaring.go @@ -659,8 +659,9 @@ func (b *Bitmap) unionIntoTarget(target *Bitmap, others ...*Bitmap) { // Once we've acquired a bitmap container (either by reusing the existing one // or allocating a new one) then the last step is to iterate through all the // other containers to see which ones have the same key, and union all of them - // into the target bitmap container. - for j, jIter := range bitmapIters { + // into the target bitmap container. Only need to loop starting from i because + // anything previous to that has already been handled. + for j, jIter := range bitmapIters[i:] { jKey, jContainer := jIter.iter.Value() if iKey == jKey {