Skip to content

perf(arrow/array): batch run-end encoded appends - #1214

Merged
zeroshade merged 1 commit into
apache:mainfrom
fallintoplace:perf/arrow-ree-bulk-appends
Aug 26, 2026
Merged

perf(arrow/array): batch run-end encoded appends#1214
zeroshade merged 1 commit into
apache:mainfrom
fallintoplace:perf/arrow-ree-bulk-appends

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

What

  • Batch RunEndEncodedBuilder.AppendNulls into one physical null value and one run.
  • Batch RunEndEncodedBuilder.AppendEmptyValues into one physical empty value and one run.
  • Keep zero and negative counts as no-ops.
  • Preserve the empty-value state used by JSON decoding.

The old implementation called the scalar append method once per logical value. This change keeps the same API while avoiding the repeated physical values and run ends.

Benchmark

Apple M1 Pro, 65,536 rows, int32 run ends and int32 encoded values:

Case Before After Speedup
Nulls ~1.0-1.6 ms, 1.16 MB, 55 allocs/op ~1.0-1.5 us, 1.7 KB, 19 allocs/op ~1,250x
Empty values ~1.2-2.7 ms, 1.16 MB, 55 allocs/op ~1.2-1.5 us, 1.7 KB, 19 allocs/op ~1,750x

The benchmark covers int16, int32, and int64 run-end types, int32 and string encoded values, and multiple batch sizes.

Tests

  • go test ./arrow/array -count=1
  • go test ./... -run '^$' -count=1 -p 2

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at fa9d776. The bulk append implementation preserves logical behavior while reducing repeated null/empty appends to a single physical run. The full arrow/array suite, race tests, semantic equivalence probes, boundary coverage, formatting, vet, and diff hygiene all passed locally.

@zeroshade
zeroshade merged commit 8d2e8f7 into apache:main Aug 26, 2026
23 checks passed
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.

2 participants