Skip to content

perf: make bitmap storage immutable, test from Swift 5.6 (supersedes #30) - #33

Merged
lemire merged 5 commits into
masterfrom
deinit-exclusivity-rebased
Oct 26, 2026
Merged

lemire merged 5 commits into
masterfrom
deinit-exclusivity-rebased

Conversation

@lemire

@lemire lemire commented Oct 26, 2026

Copy link
Copy Markdown
Member

This supersedes #30 by @vsarunas. #30 conflicts with master and comes from a fork that doesn't allow maintainer edits, so it couldn't be updated in place.

From #30

The four commits are cherry-picked onto master unchanged, and @vsarunas remains their author:

  • ptr and frozenBacking become let, which removes two dynamic exclusivity checks from every deinit. Census1881 random access gets about 20% faster; the benchmark is in perf: make bitmap storage immutable, test from Swift 5.6 #30.
  • RoaringBitmap's decoder throws DecodingError on corrupt input instead of crashing.
  • CI runs in swift:5.6-focal, 5.10, 6.2 and latest containers, replacing fwal/setup-swift, which doesn't support Ubuntu 26.04. swift-tools-version goes to 5.6, and actions/checkout to v7.

The only conflict was tests.yml. #30's container matrix replaces the stopgap in f594ff9.

Added here

  • Both decoders now validate. CRoaring's safe deserializers only bound their reads. A payload with a well-formed header over bad containers still gives a bitmap, and CRoaring's header warns that using it may crash. Both init(from:) now call internal_validate and throw DecodingError.dataCorrupted with CRoaring's reason. New tests swap the last two values of an encoded array container. Before this change, that input decoded without an error.
  • Clearer errors. The 32-bit decoder reports invalid base64 and an unreadable payload separately, like the 64-bit one.
  • README badge. It points at the renamed workflow (tests.yml).

Testing

  • macOS, Swift 6.2.4: 91 tests pass with swift test, --sanitize=address and --sanitize=undefined.
  • Linux containers: swift:5.6-focal and 5.10 run 89 tests (the RawSpan tests need 6.2), and 6.2 and latest (6.4.1) run 91. All pass.

vsarunas and others added 5 commits October 26, 2026 15:56
CRoaring's safe deserializers only bound their reads: a payload with a
well-formed header over bad containers (unsorted array values, say)
still yields a bitmap, and the header warns that using it may crash. Both
Decodable inits now call internal_validate and throw
DecodingError.dataCorrupted with CRoaring's reason. The tests swap the
last two values of an encoded array container, which decoded without an
error before.

The 32-bit decoder now reports invalid base64 and an unreadable payload
separately, like the 64-bit one, with the same guard-let structure.

The README badge pointed at the old workflow name, "Swift on Ubuntu
(latest)"; it now points at tests.yml.
@lemire
lemire merged commit e419408 into master Oct 26, 2026
7 checks passed
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.

2 participants