Skip to content

perf(parquet): Defer fixed length byte array buffer alloc and skip zero-batch init#9756

Open
lyang24 wants to merge 1 commit intoapache:mainfrom
lyang24:prealloc_follow_ups
Open

perf(parquet): Defer fixed length byte array buffer alloc and skip zero-batch init#9756
lyang24 wants to merge 1 commit intoapache:mainfrom
lyang24:prealloc_follow_ups

Conversation

@lyang24
Copy link
Copy Markdown
Contributor

@lyang24 lyang24 commented Apr 17, 2026

follow ups from #9093

  • FixedLenByteArrayBuffer: preserve the value-count hint in with_capacity and defer the buffer allocation to the first ValueDecoder::read, when byte_length is known. This lets the buffer be sized exactly once (values_capacity * byte_length) instead of growing incrementally from Vec::new().
  • RecordReader::read_one_batch: short-circuit with Ok(0) when batch_size == 0 to avoid the lazy buffer init on an end-of-stream read.

Which issue does this PR close?

  • Closes #NNN.

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

- FixedLenByteArrayBuffer: preserve the value-count hint in
  `with_capacity` and defer the buffer allocation to the first
  `ValueDecoder::read`, when `byte_length` is known. This lets the
  buffer be sized exactly once (`values_capacity * byte_length`)
  instead of growing incrementally from `Vec::new()`.
- RecordReader::read_one_batch: short-circuit with `Ok(0)` when
  `batch_size == 0` to avoid the lazy buffer init on an end-of-stream
  read.

Signed-off-by: lyang24 <lanqingy93@gmail.com>
@github-actions github-actions bot added the parquet Changes to the parquet crate label Apr 17, 2026
@lyang24 lyang24 changed the title perf(parquet): Fixed length byte array reader preallocate after first read and reduce allocs perf(parquet): Defer fixed length byte array buffer alloc and skip zero-batch init Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parquet Changes to the parquet crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant