Skip to content

perf: make bitmap storage immutable, test from Swift 5.6 - #30

Closed
vsarunas wants to merge 4 commits into
RoaringBitmap:masterfrom
ordo-one:deinit-exclusivity
Closed

vsarunas wants to merge 4 commits into
RoaringBitmap:masterfrom
ordo-one:deinit-exclusivity

Conversation

@vsarunas

@vsarunas vsarunas commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Hi @lemire !

  • ptr and frozenBacking were declared var but never reassigned, so every deinit paid for two dynamic exclusivity checks. Making them let makes the census1881 benchmark run ~20% faster.
  • RoaringBitmap now throws DecodingError on corrupt input instead of crashing, the same as Roaring64Bitmap.
  • CI broke because fwal/setup-swift doesn't support Ubuntu 26.04, which ubuntu-latest now runs. It's replaced with swift container jobs for 5.6, 5.10, 6.2 and latest 6.4.
  • swift-tools-version goes from 4.0 to 5.6, the oldest Swift that accepts any Encoder. Master already failed to build below 5.5. 5.6 was released in March 2022.
  • Bump actions checkout version to avoid warning.

Performance improvement

./fetch-datasets.sh
git checkout master
swift package --allow-writing-to-package-directory benchmark baseline update main --filter 'microbench/RandomAccess/census1881'
git checkout deinit-exclusivity
swift package --allow-writing-to-package-directory benchmark baseline update pull_request --filter 'microbench/RandomAccess/census1881'
swift package benchmark baseline compare main pull_request
╒══════════════════════════════════════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╕
│         Time (wall clock) (ns) *         │        p0 │       p25 │       p50 │       p75 │       p90 │       p99 │      p100 │   Samples │
╞══════════════════════════════════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡
│                   main                   │      2750 │      2917 │      2959 │      3043 │      3125 │      3501 │     58667 │     10000 │
├──────────────────────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│               pull_request               │      2209 │      2375 │      2417 │      2459 │      2541 │      2959 │     16083 │     10000 │
├──────────────────────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│                    Δ                     │      -541 │      -542 │      -542 │      -584 │      -584 │      -542 │    -42584 │         0 │
├──────────────────────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│              Improvement %               │        20 │        19 │        18 │        19 │        19 │        15 │        73 │         0 │
╘══════════════════════════════════════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╛

╒══════════════════════════════════════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╕
│            Instructions (K) *            │        p0 │       p25 │       p50 │       p75 │       p90 │       p99 │      p100 │   Samples │
╞══════════════════════════════════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡
│                   main                   │        47 │        47 │        47 │        47 │        47 │        47 │        71 │     10000 │
├──────────────────────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│               pull_request               │        38 │        38 │        38 │        38 │        38 │        38 │        53 │     10000 │
├──────────────────────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│                    Δ                     │        -9 │        -9 │        -9 │        -9 │        -9 │        -9 │       -18 │         0 │
├──────────────────────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│              Improvement %               │        19 │        19 │        19 │        19 │        19 │        19 │        25 │         0 │
╘══════════════════════════════════════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╛

lemire added a commit that referenced this pull request Oct 26, 2026
perf: make bitmap storage immutable, test from Swift 5.6 (supersedes #30)
@lemire lemire closed this Oct 26, 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.

2 participants