Repository navigation
Conversation
Move the A/B into keccak_asm_test.go so amd64 runs it too, reuse benchSizes/benchName so the names line up with the rest of the suite, and gate the assembly arm on a new immutable hasASM probe instead of the useASM flag this benchmark mutates. The recorded digest is now compared across the two backends rather than only written.
`-bench BenchmarkBackends/ASM` ran one arm, so the cross-arm compare had nothing to compare and reported success on a corrupted digest.
FoundA Reproduced by injecting a one-bit corruption into
FixedEach arm is now compared against an x/crypto reference computed per size, so there is no cross-arm state and no filter can disable it — the map is gone too. 72b4bfc Verified: with the same corruption, Verified clean
|
Summary
Reset,Write, andReadwith reusable output for both backendsWhy
Instruction availability does not prove that a backend is faster on every ARM core. This benchmark makes the dispatch choice measurable on Apple Silicon and Linux ARM64 systems. When SHA3 is unavailable, it reports the fallback only and never executes unsupported instructions.
This is a benchmark-only addition, so TDD is not applicable.
Benchmark
Apple M2 Max, Go 1.25.7, median of five 300 ms runs:
Both paths report zero allocations with this call shape. The main value of the benchmark is running the same comparison on other ARM64 processors before changing dispatch policy.
Verification
go test ./...go test -race ./...go test -tags purego ./...go vet ./...go test -run '^$' -bench '^BenchmarkARM64Backends$' -benchmem -benchtime=300ms -count=5 ./...go mod tidy -diffgolangci-lint run(twice)