lichuang opened a new pull request, #12356: URL: https://github.com/apache/arrow-rs/pull/12356
# Which issue does this PR close? - Part of #9298 # Rationale for this change #9298 asks for array construction to move off `ArrayData`. Such a change is only reviewable with measurements: the gain is a fixed per-array cost, so it disappears from a benchmark dominated by appending values. The existing `arrow/benches/builder.rs` measures large batches (`8 << 10` values times 64 batches), which is the wrong shape for a per-`finish` cost, and it lives in the `arrow` crate rather than next to the builders it measures. `arrow-array` has no benchmark for builder `finish` today. # What changes are included in this PR? A new `arrow-array/benches/builder_finish.rs`, registered in `arrow-array/Cargo.toml`, that measures `finish` in isolation for every `ArrayBuilder` implementation in the crate: | Group | Builder | |---|---| | `primitive_builder_finish` | `PrimitiveBuilder<T>`, including the decimal, timestamp, time, date, interval and duration aliases | | `boolean_builder_finish` | `BooleanBuilder` | | `byte_builder_finish` | `GenericByteBuilder<T>`, including `StringBuilder`, `BinaryBuilder` and the large variants | | `fixed_size_binary_builder_finish` | `FixedSizeBinaryBuilder` | | `byte_view_builder_finish` | `GenericByteViewBuilder<T>`, including `StringViewBuilder` and `BinaryViewBuilder` | | `null_builder_finish` | `NullBuilder` | | `map_builder_finish` | `MapBuilder` | | `primitive_dictionary_builder_finish` | `PrimitiveDictionaryBuilder` | | `byte_dictionary_builder_finish` | `GenericByteDictionaryBuilder` | | `fixed_size_binary_dictionary_builder_finish` | `FixedSizeBinaryDictionaryBuilder` | | `struct_builder_finish` | `StructBuilder` | | `list_builder_finish` | `GenericListBuilder`, including `ListBuilder` and `LargeListBuilder` | | `fixed_size_list_builder_finish` | `FixedSizeListBuilder` | | `list_view_builder_finish` | `GenericListViewBuilder`, including `ListViewBuilder` and `LargeListViewBuilder` | | `primitive_run_builder_finish` | `PrimitiveRunBuilder` | | `byte_run_builder_finish` | `GenericByteRunBuilder` | | `union_dense_builder_finish`, `union_sparse_builder_finish` | `UnionBuilder` | Each group runs at `len` 1, 8 and 64, where the fixed cost of finishing dominates. The builders are constructed in criterion's setup closure with `iter_batched`, so only `finish` is timed. Type aliases share one implementation and one measurement each; the generic parameter is not multiplied, since it cannot change the code path. This PR adds no production code and changes no behaviour. # Are these changes tested? `cargo bench -p arrow-array --bench builder_finish -- --list` lists 54 cases and `cargo bench -p arrow-array --bench builder_finish` runs them all without panicking. `cargo check -p arrow-array --benches`, Clippy with `--all-features --all-targets -- -D warnings` and `cargo fmt --all -- --check` all pass. # Are there any significant user-facing changes? No. This only adds a benchmark. # AI usage disclosure This change was prepared with AI assistance. I reviewed the benchmark and verified that it runs, compiles and passes Clippy and formatting locally. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
