Skip to content

Upgrade CRoaring to v5.5.5 and avoid len() in x[i] - #155

Open
lemire wants to merge 2 commits into
Ezibenroc:masterfrom
lemire:croaring-5.5.4
Open

lemire wants to merge 2 commits into
Ezibenroc:masterfrom
lemire:croaring-5.5.4

Conversation

@lemire

@lemire lemire commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

This PR upgrades CRoaring from v5.2.2 to v5.5.5 and makes x[i] faster.

Changes

Benchmarks

Intel Xeon Gold 6548N (AVX-512), Python 3.14, pinned to one core, median of 3 runs. Each figure is this branch's time divided by the time of pyroaring 1.0.x with CRoaring 4.2.3 (below 1 is faster). These were measured with CRoaring v5.5.4; v5.5.5 only adds bug fixes:

operation 32-bit 64-bit
x[i] (1M values) 0.55 0.22 (select)
x[0] 0.17
to_array() 0.21 0.28
intersection 0.30 0.30
add / discard / contains 0.93 / 0.92 / 0.82 1.03 / 1.03 / 1.00
list constructor 0.84 0.92
union, difference, xor, equality, subset, slices, pickle 0.97–1.04 0.97–1.03

Testing

test.py, test_state_machine.py (32- and 64-bit) pass on macOS arm64 with Python 3.14, 3.14t, 3.15 and 3.15t. On the free-threaded builds, the GIL stays disabled after import. They also pass on Linux x86-64 with Python 3.14.

With v5.5.5, test.py passes on macOS arm64 with Python 3.14.

For a non-negative index, _get_elt now calls select directly: it reports
an out-of-range rank itself, so the cardinality scan done by len() is
unnecessary.
@lemire lemire changed the title Upgrade CRoaring to v5.5.4 and avoid len() in x[i] Upgrade CRoaring to v5.5.5 and avoid len() in x[i] Nov 4, 2026
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.

1 participant