Skip to content

Add pmull-based aarch64 crc32 implementation#514

Draft
folkertdev wants to merge 1 commit into
mainfrom
apple-zlib-crc32
Draft

Add pmull-based aarch64 crc32 implementation#514
folkertdev wants to merge 1 commit into
mainfrom
apple-zlib-crc32

Conversation

@folkertdev

Copy link
Copy Markdown
Member

Blocked on rust-lang/miri#5070, it also needs CI setup.

Based on the assembly in https://github.com/apple-oss-distributions/zlib/blob/06673bf7cb4066003fd14a0b87085c05739fc4ac/AddOn/ZAssembly/crc32lt_arm64.s.

On a mac mini we see

----------------------------------------------------------------------------------------------------
  CHECKSUMS
----------------------------------------------------------------------------------------------------
Benchmark                                  CPython zlib        zlib_py          Speedup
----------------------------------------------------------------------------------------------------
adler32   1 KB                                   0.1 us         0.2 us     1.33x slower
crc32     1 KB                                   0.1 us         0.3 us     2.00x slower
adler32  64 KB                                   3.7 us         2.0 us     1.83x faster
crc32    64 KB                                   2.6 us         2.8 us     1.10x slower
adler32   1 MB                                  57.0 us        30.3 us     1.88x faster
crc32     1 MB                                  28.6 us        41.0 us     1.43x slower
adler32  10 MB                                 568.9 us       301.5 us     1.89x faster
crc32    10 MB                                 286.3 us       405.6 us     1.42x slower

versus

----------------------------------------------------------------------------------------------------
  CHECKSUMS
----------------------------------------------------------------------------------------------------
Benchmark                                  CPython zlib        zlib_py          Speedup
----------------------------------------------------------------------------------------------------
adler32   1 KB                                   0.1 us         0.2 us     1.33x slower
crc32     1 KB                                   0.1 us         0.2 us     1.33x slower
adler32  64 KB                                   3.7 us         2.0 us     1.83x faster
crc32    64 KB                                   2.6 us         1.8 us     1.41x faster
adler32   1 MB                                  57.0 us        30.3 us     1.88x faster
crc32     1 MB                                  28.7 us        26.7 us     1.08x faster
adler32  10 MB                                 568.6 us       301.9 us     1.88x faster
crc32    10 MB                                 286.8 us       265.9 us     1.08x faster

@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.30841% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
zlib-rs/src/crc32/pmull.rs 84.04% 15 Missing ⚠️
zlib-rs/src/crc32.rs 33.33% 4 Missing ⚠️
zlib-rs/src/cpu_features.rs 85.71% 1 Missing ⚠️
Flag Coverage Δ
fuzz-compress 39.56% <0.00%> (-0.29%) ⬇️
fuzz-decompress 27.26% <0.00%> (-0.06%) ⬇️
test-aarch64-apple-darwin 87.89% <81.73%> (-0.10%) ⬇️
test-aarch64-unknown-linux-gnu 85.33% <81.73%> (-0.05%) ⬇️
test-i686-unknown-linux-gnu 84.98% <0.00%> (-0.03%) ⬇️
test-x86_64-apple-darwin 88.24% <0.00%> (-0.04%) ⬇️
test-x86_64-unknown-linux-gnu 89.41% <0.00%> (-2.99%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
zlib-rs/src/cpu_features.rs 68.18% <85.71%> (+2.39%) ⬆️
zlib-rs/src/crc32.rs 91.08% <33.33%> (-3.71%) ⬇️
zlib-rs/src/crc32/pmull.rs 84.04% <84.04%> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@folkertdev
folkertdev force-pushed the apple-zlib-crc32 branch 2 times, most recently from f94dbb7 to dcbed99 Compare June 9, 2026 18:26
Based on the apple zlib assembly implementation
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