simd/adler32: Add SIMD Adler-32 with AVX2 and NEON kernels #28
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 334 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.348
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #28"
general
weight: 0.35
pjbgf
Computing zlib checksums with
hash/adler32takes a measurable share of the time spent reading and writing packfiles and loose objects. This adds asimdmodule whoseadler32package has the same API ashash/adler32and returns identical results, using vectorised kernels. Likehash/adler32, the hash returned byNewalso marshals, restores and clones its state, in the same format, so state saved by either package restores in the other.The kernels:
puregobuilds, uses a portable Go implementation.A zlib implementation that uses it follows in a stacked PR.
Benchmarks
Against
hash/adler32, measured in CI and locally:| Platform | 64 B | 4 KiB and larger |
| --- | --- | --- |
| amd64, AVX2 (EPYC, Xeon 6975P, Xeon 8370C) | 2.1–2.6x faster | 11–16x faster |
| arm64, Neoverse | 12.8 ns vs 24.5 ns | ~24 GiB/s vs 2.7 GiB/s |
| arm64, Apple M2 | 13.5 ns vs 20.5 ns | 45–48 GiB/s |
Testing
simd_asmtestbuild tag, whichmake testsets, the NEON kernel is also called through a harness that fills every general-purpose and vector register with garbage first.hash/adler32across split writes and arbitrary starting states. Long-running fuzzing will be added to OSS-Fuzz.hash/adler32, and the other way round.CI and Makefile
test.ymlnow also runs onubuntu-24.04-armandmacos-latest, so the NEON kernel runs on Neoverse and Apple silicon. It gains two jobs:benchmarkruns on pull requests and manual dispatch and compares results against the base branch with benchstat. The results go to the step summary.fuzzruns every fuzz target for 30 seconds, with the corpus cached between runs.New
maketargets:bench,bench-compare(runsBASEand the working tree in turns, then compares them with benchstat) andfuzz. Tests and lint now build with thesimd_asmtesttag.Licensing
The portable implementation is derived from Go's
hash/adler32and carries Go's BSD licence notice. The SIMD kernels are new code. Their structure follows Chromium zlib'sadler32_simd.c, which the assembly comments credit.Generated with Claude Code