Skip to content

Report statistics byte counts in bytes - #397

Open
emschwartz wants to merge 1 commit into
RoaringBitmap:mainfrom
emschwartz:fix-statistics-units
Open

emschwartz wants to merge 1 commit into
RoaringBitmap:mainfrom
emschwartz:fix-statistics-units

Conversation

@emschwartz

Copy link
Copy Markdown
Contributor

Closes #371 (thanks @fjmaco for the clear write-up; happy to close this if you already have a branch).

n_bytes_array_containers now counts 2 bytes per slot of the Vec<u16>, and n_bytes_bitset_containers counts 8,192 bytes per bitmap instead of its bit count. Array containers still count capacity, not length. BitmapStore::capacity had no other caller, so it is removed. Anyone reading these fields will see array counts halve and bitset counts drop 8x.

Run and bitset byte counts now match CRoaring's, so the against_croaring fuzzer compares them again (array bytes stay excluded, since they depend on capacity). A 90-second local fuzz run passed. The new statistics_bitset_bytes test fails without the fix (left: 65536, right: 8192), and the statistics() doctest goes from 512 to 256.

Authored with Claude (claude-opus-5-5).

n_bytes_array_containers multiplied the capacity of the Vec<u16> by
size_of::<u32>(), and n_bytes_bitset_containers added the bitmap's
capacity in bits (65,536) instead of its size in bytes (8,192).

BitmapStore::capacity was only used for this, so remove it. With run
and bitset bytes now matching CRoaring, the fuzzer compares them again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

statistics(): n_bytes_array_containers and n_bytes_bitset_containers are not in bytes

1 participant