MCPcopy
hub / github.com/RoaringBitmap/roaring / runOptimize

Method runOptimize

roaringarray.go:139–143  ·  view source on GitHub ↗

runOptimize compresses the element containers to minimize space consumed. Q: how does this interact with copyOnWrite and needCopyOnWrite? A: since we aren't changing the logical content, just the representation, we don't bother to check the needCopyOnWrite bits. We replace (possibly all) elements

()

Source from the content-addressed store, hash-verified

137// (possibly all) elements of ra.containers in-place with space
138// optimized versions.
139func (ra *roaringArray) runOptimize() {
140 for i := range ra.containers {
141 ra.containers[i] = ra.containers[i].toEfficientContainer()
142 }
143}
144
145func (ra *roaringArray) appendContainer(key uint16, value container, mustCopyOnWrite bool) {
146 ra.keys = append(ra.keys, key)

Callers 2

RunOptimizeMethod · 0.45

Calls 1

toEfficientContainerMethod · 0.65