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

Method toEfficientContainer

arraycontainer.go:1282–1295  ·  view source on GitHub ↗

convert to run or array *if needed*

()

Source from the content-addressed store, hash-verified

1280
1281// convert to run or array *if needed*
1282func (ac *arrayContainer) toEfficientContainer() container {
1283 numRuns := ac.numberOfRuns()
1284 sizeAsRunContainer := runContainer16SerializedSizeInBytes(numRuns)
1285 sizeAsBitmapContainer := bitmapContainerSizeInBytes()
1286 card := ac.getCardinality()
1287 sizeAsArrayContainer := arrayContainerSizeInBytes(card)
1288 if sizeAsRunContainer < minOfInt(sizeAsBitmapContainer, sizeAsArrayContainer) {
1289 return newRunContainer16FromArray(ac)
1290 }
1291 if card <= arrayDefaultMaxSize {
1292 return ac
1293 }
1294 return ac.toBitmapContainer()
1295}
1296
1297func (ac *arrayContainer) containerType() contype {
1298 return arrayContype

Callers

nothing calls this directly

Calls 8

numberOfRunsMethod · 0.95
getCardinalityMethod · 0.95
toBitmapContainerMethod · 0.95
minOfIntFunction · 0.70

Tested by

no test coverage detected