Repository navigation
Optimize bitmap container batch iteration - #553
perfloop-agent wants to merge 2 commits into
Conversation
|
Negative result on amd64: at the default
Other amd64 results from the same runs, for balance:
Treat the amd64 numbers with some caution, because they look sensitive to code shape as well as to the instruction chosen. A functionally equivalent loop that did not use On arm64 this change is a clear win, at 20–50% with buffers of 512 or more across Neoverse N1, V1 and V2. #591 applies the same loop to arm64 only and leaves amd64 machine code byte-identical to master, with the full arm64 numbers there. |
|
Thanks for the careful numbers. I re-ran this on an AMD EPYC 7B13 (Zen 3), go1.27.3, 20 interleaved rounds against master 33586ce, with the loop moved behind |
arm64 has no scalar popcount, so bits.OnesCount64 goes through the vector unit for every set bit. On arm64 only, use bits.TrailingZeros64 and, when the buffer has room, drain a whole word at a time, the approach from #553. Other targets keep the existing loop. A compile-time constant removes the new code there, and the amd64 machine code of nextMany and nextMany64 is byte-identical to master at GOAMD64=v1 and v3. On amd64 the effect of this rewrite varied with the microarchitecture and with small code-shape changes. Add a buffer-size test and a benchmark for nextMany64. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Description
Optimize bitmap-container batch decoding for
ManyIteratorandToArray.Type of Change
Changes Made
What was changed?
bitmapContainerManyIterator.nextManyandnextMany64withbits.TrailingZeros64and lowest-set-bit clearing.ToArrayandManyIteratordecoding paths.Why was it changed?
How was it changed?
Testing
go test -vgo test -v ./roaring64go test -v ./BitSliceIndexinggo tool unconvert ./...Checks: 4 passed.
Formatting
gofmton the changed Go files.Fuzzing
Performance Impact
Workload:
roaring64ToArrayns/opWorkload:
roaring64ManyIteratorns/opBreaking Changes
Related Issues
Additional Notes
Generated by Perfloop. Measurements and checks.