Skip to content

perf: count bitmap store cardinality with SIMD - #400

Open
Dr-Emann wants to merge 1 commit into
push-rxyxkmvuzwunfrom
push-kkvtnkmwzvvv
Open

Dr-Emann wants to merge 1 commit into
push-rxyxkmvuzwunfrom
push-kkvtnkmwzvvv

Conversation

@Dr-Emann

@Dr-Emann Dr-Emann commented Nov 9, 2026

Copy link
Copy Markdown
Member

Add count_bits for computing the popcount of a full bitmap store, used by BitmapStore::try_from and internal_validate. It uses a native vector popcount on NEON and AVX-512, and a Harley-Seal carry-save adder popcount on other targets, similar to CRoaring.

group                                                         main                                   simd
-----                                                         ----                                   ----
Successive Or/Multi Or Owned/census-income                    1.04    733.0±4.58µs        ? ?/sec    1.00    707.8±5.19µs        ? ?/sec
Successive Or/Multi Or Owned/weather_sept_85                  1.00      3.4±0.02ms        ? ?/sec    1.00      3.4±0.02ms        ? ?/sec
Successive Or/Multi Or Ref/census-income                      1.04   724.9±62.14µs        ? ?/sec    1.00    695.8±7.22µs        ? ?/sec
Successive Or/Multi Or Ref/weather_sept_85                    1.01      3.4±0.03ms        ? ?/sec    1.00      3.4±0.02ms        ? ?/sec
Successive Or/Successive Or Assign Owned/census-income        1.01   979.7±12.99µs        ? ?/sec    1.00    968.9±5.67µs        ? ?/sec
Successive Or/Successive Or Assign Owned/weather_sept_85      1.00      3.4±0.03ms        ? ?/sec    1.00      3.4±0.02ms        ? ?/sec
Successive Or/Successive Or Assign Ref/census-income          1.01   959.4±12.58µs        ? ?/sec    1.00    954.6±4.65µs        ? ?/sec
Successive Or/Successive Or Assign Ref/weather_sept_85        1.01      3.4±0.05ms        ? ?/sec    1.00      3.4±0.02ms        ? ?/sec
Successive Or/Successive Or Ref Ref/census-income             1.00  1066.5±13.54µs        ? ?/sec    1.00   1062.7±8.71µs        ? ?/sec
Successive Or/Successive Or Ref Ref/weather_sept_85           1.00      4.1±0.05ms        ? ?/sec    1.00      4.1±0.03ms        ? ?/sec
deserialization/deserialize_from/census-income                1.02    439.1±3.07µs     5.0 GB/sec    1.00    431.6±7.17µs     5.1 GB/sec
deserialization/deserialize_from/weather_sept_85              1.02  1859.2±21.77µs     4.4 GB/sec    1.00  1831.4±12.78µs     4.5 GB/sec
deserialization/deserialize_unchecked_from/census-income      1.07    131.2±2.52µs    16.8 GB/sec    1.00    123.1±2.48µs    17.9 GB/sec
deserialization/deserialize_unchecked_from/weather_sept_85    1.00    422.4±5.75µs    19.3 GB/sec    1.00    421.5±4.87µs    19.3 GB/sec
pairwise_and/assign_ref/census-income                         1.01   609.0±40.62µs        ? ?/sec    1.00   604.9±34.98µs        ? ?/sec
pairwise_and/assign_ref/weather_sept_85                       1.02      2.3±0.10ms        ? ?/sec    1.00      2.2±0.08ms        ? ?/sec
pairwise_or/assign_ref/census-income                          1.01  1075.1±35.94µs        ? ?/sec    1.00  1067.2±30.78µs        ? ?/sec
pairwise_or/assign_ref/weather_sept_85                        1.02      5.6±0.16ms        ? ?/sec    1.00      5.4±0.14ms        ? ?/sec
pairwise_sub/assign_ref/census-income                         1.01   684.3±31.10µs        ? ?/sec    1.00   679.9±35.94µs        ? ?/sec
pairwise_sub/assign_ref/weather_sept_85                       1.01      2.9±0.10ms        ? ?/sec    1.00      2.8±0.12ms        ? ?/sec
pairwise_xor/assign_ref/census-income                         1.01  1095.5±37.79µs        ? ?/sec    1.00  1087.3±25.82µs        ? ?/sec
pairwise_xor/assign_ref/weather_sept_85                       1.01      5.5±0.11ms        ? ?/sec    1.00      5.4±0.14ms        ? ?/sec

Only a few percent faster, but seemingly consistently faster, on my M1 Pro, at least.

@Dr-Emann
Dr-Emann added this pull request to stack #401 November 9, 2026 03:55
Add count_bits for computing the popcount of a full bitmap store, used
by BitmapStore::try_from and internal_validate. It uses a native vector
popcount on NEON and AVX-512, and a Harley-Seal carry-save adder
popcount on other targets, similar to CRoaring.

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.

1 participant