Skip to content

Commit

Permalink
runcontainer: make fewer memory allocations in iandNotRunContainer16().
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dominiquelefevre committed Dec 23, 2024
1 parent 84c242d commit cdb209e
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions runcontainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2464,12 +2464,8 @@ 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
}
Expand Down

0 comments on commit cdb209e

Please sign in to comment.