perf(arrow/array): remove map validity slice - #1228
Merged
zeroshade merged 1 commit intoAug 28, 2026
Merged
Conversation
zeroshade
approved these changes
Aug 28, 2026
zeroshade
left a comment
Member
There was a problem hiding this comment.
Verified the map validity fast path preserves output semantics and raw buffers across bitmap boundaries, builder reuse, mixed builder workflows, nested maps, invalid-state handling, and randomized cases. Array, race, vet, LSP, allocator, and performance checks pass. The allocation reduction is reproducible.
Nice improvement—thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MapBuilder.adjustStructBuilderLen.NewMapArrayafter bulk key/item appends.The benchmark stops the timer while setting up the map entries, so it focuses on the finalization path where the temporary slice was created.
Benchmark
Measured on Apple M1 Pro, macOS arm64, Go 1.26.3. Median of 3 runs. Each result is
time/op,B/op, andallocs/op.For 65,536 entries, this reduces bytes allocated by about 74% and removes one allocation per operation. The 1,024-entry case removes the temporary 1,024-byte slice as well.
Command:
Tests
go test ./arrow/array -run 'TestMap' -count=1go test ./... -count=1with the pinnedarrow-testingandparquet-testingsubmodules initialized