From 51933bc3af5fced7540c6cb9b709008ca6fd7ae7 Mon Sep 17 00:00:00 2001 From: Dominique Lefevre Date: Mon, 23 Dec 2024 13:42:50 +0200 Subject: [PATCH] runcontainer: make fewer memory allocations in iandNotRunContainer16(). There is no need to convert both run containers to bitmap containers first. There already is an efficient implementation of andNot in AndNotRunContainer16(), so use it. --- runcontainer.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/runcontainer.go b/runcontainer.go index 6270c8c2..f1f7d38a 100644 --- a/runcontainer.go +++ b/runcontainer.go @@ -2464,12 +2464,7 @@ func (rc *runContainer16) toBitmapContainer() *bitmapContainer { } func (rc *runContainer16) iandNotRunContainer16(x2 *runContainer16) container { - rcb := rc.toBitmapContainer() - x2b := x2.toBitmapContainer() - rcb.iandNotBitmapSurely(x2b) - // TODO: check size and optimize the return value - // TODO: is inplace modification really required? If not, elide the copy. - rc2 := newRunContainer16FromBitmapContainer(rcb) + rc2 := rc.AndNotRunContainer16(x2) *rc = *rc2 return rc }