Skip to content

refactor: keep masks in simd until we need to covert them to bitmasks - #388

Merged
Kerollmops merged 1 commit into
stable_simd_refactorfrom
stable_simd_compress
Oct 26, 2026
Merged

Kerollmops merged 1 commit into
stable_simd_refactorfrom
stable_simd_compress

Conversation

@Dr-Emann

Copy link
Copy Markdown
Member

The array store vector ops now pass lane masks around as mask16x8<S> instead of turning them into u8 bitmasks at every step.

@Dr-Emann
Dr-Emann added this pull request to stack #381 October 12, 2026 03:52
@Dr-Emann
Dr-Emann force-pushed the stable_simd_compress branch from cc8d32f to 7064443 Compare October 12, 2026 04:14
@Dr-Emann
Dr-Emann force-pushed the stable_simd_compress branch from 7064443 to 647c258 Compare October 22, 2026 03:23

@Kerollmops Kerollmops left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for bumping the fearless_simd, I didn't saw that before.

It seems that the CI is unhappy about this change 👀

The array store vector ops now pass lane masks around as `mask16x8<S>`
instead of turning them into `u8` bitmasks at every step.

This also uses simd_ne where applicable, and .compress(), new in
fearless_simd 1.1
@Dr-Emann

Dr-Emann commented Oct 25, 2026 •

Copy link
Copy Markdown
Member Author

Comparing this branch vs main (with and without simd):
M1 Pro (aarch64), nightly 1.101.0 (2026-10-24).

bench dataset main main + simd stable_simd_compress
and/len census1881 106.5 µs (1.00×) 59.5 µs (1.79×) 60.3 µs (1.76×)
and/len census1881_srt 19.2 µs (1.00×) 15.9 µs (1.20×) 16.0 µs (1.19×)
and/len wikileaks-noquotes 255.0 µs (1.00×) 100.5 µs (2.54×) 101.5 µs (2.51×)
and/ref_ref census1881 184.2 µs (1.00×) 149.0 µs (1.24×) 147.8 µs (1.25×)
and/ref_ref census1881_srt 111.0 µs (1.00×) 108.4 µs (1.02×) 114.7 µs (0.97×)
and/ref_ref wikileaks-noquotes 366.8 µs (1.00×) 243.1 µs (1.51×) 249.7 µs (1.47×)
or/ref_ref census1881 468.2 µs (1.00×) 534.8 µs (0.88×) 461.7 µs (1.01×)
or/ref_ref census1881_srt 305.1 µs (1.00×) 383.1 µs (0.80×) 322.6 µs (0.95×)
or/ref_ref wikileaks-noquotes 552.3 µs (1.00×) 565.4 µs (0.98×) 466.9 µs (1.18×)
sub/ref_ref census1881 333.6 µs (1.00×) 294.0 µs (1.13×) 298.8 µs (1.12×)
sub/ref_ref census1881_srt 214.5 µs (1.00×) 210.2 µs (1.02×) 218.0 µs (0.98×)
sub/ref_ref wikileaks-noquotes 461.4 µs (1.00×) 319.6 µs (1.44×) 325.0 µs (1.42×)
xor/ref_ref census1881 475.9 µs (1.00×) 510.1 µs (0.93×) 471.3 µs (1.01×)
xor/ref_ref census1881_srt 310.7 µs (1.00×) 316.6 µs (0.98×) 317.1 µs (0.98×)
xor/ref_ref wikileaks-noquotes 547.0 µs (1.00×) 543.6 µs (1.01×) 489.5 µs (1.12×)

Geometric Means

bench main main + simd stable_simd_compress
and/len 1.00× 1.76× 1.74×
and/ref_ref 1.00× 1.24× 1.21×
or/ref_ref 1.00× 0.88× 1.04×
sub/ref_ref 1.00× 1.19× 1.16×
xor/ref_ref 1.00× 0.97× 1.03×
all 1.00× 1.17× 1.21×

Results varied 2% between passes for the median benchmark and 6.4% at the 90th percentile, so differences of a few percent are probably noise.

  • SIMD helps and/sub are faster with either SIMD version, up to 2.5× on wikileaks-noquotes and/len. On census1881_srt neither version gains much, because its containers hold about 72 elements on average.
  • or/xor: main's simd feature makes or slower than without SIMD (0.88×). stable_simd_compress is at least as fast as plain main on or/xor everywhere except census1881_srt or, where it's 0.95×.
  • Overall: stable_simd_compress is 1.21× faster than main without SIMD, against 1.17× for main + simd.

@Kerollmops
Kerollmops dismissed their stale review October 26, 2026 15:48

CI's fixed

@Kerollmops

Copy link
Copy Markdown
Member

Hey @Dr-Emann 👋

Thank you very much for the performance measurements. Performances are impressive and it's faster than the SIMD implementation we had. I'm ready to merge all of your PR's in one go.

Thank you very much and be ready 🌵

@Kerollmops
Kerollmops added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit c19777e Oct 26, 2026
42 checks passed
@Kerollmops
Kerollmops deleted the stable_simd_compress branch October 26, 2026 15:51
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