Skip to content

perf(arrow/array): copy view buffers directly - #1324

Open
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:perf/arrow-view-concat-direct
Open

fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:perf/arrow-view-concat-direct

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

What

  • Copy BinaryView headers and ListView sizes directly from ArrayData during concatenation.

Why

  • Avoid one temporary memory.Buffer wrapper per input chunk.
  • Reduce allocations for fragmented view arrays.

Implementation

  • Use the existing concatFixedWidthBuffers helper for BinaryView headers and ListView/LargeListView sizes.
  • Added a benchmark for 64, 1,024, and 8,192 chunks.
  • Existing concatenate tests cover sliced and nullable view arrays.

Benchmark on an Apple M1 Pro:

Case Runtime before -> after Allocations before -> after
BinaryView, 1,024 chunks 1.02ms -> 0.93ms 1,050 -> 25
BinaryView, 8,192 chunks roughly flat 8,227 -> 34
ListView, 8,192 chunks 2.27ms -> 1.92ms 26,477 -> 18,388
LargeListView, 8,192 chunks 2.28ms -> 1.95ms 26,124 -> 17,304

Tests:

  • go test ./arrow/array -count=1
  • go vet ./arrow/array
  • git diff --check

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