This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-11461-a8ee70c9c4d6f4a7f46884007cdbc22fc8757b77 in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
commit c07655f8e986834f2aebf9de46ba1c02ac58d32a Author: Artem Osipov <[email protected]> AuthorDate: Fri Oct 9 15:07:23 2026 +0000 Benchmark Variant ObjectBuilder::insert with unique-field validation (#11461) Adds a focused Criterion benchmark for inserting 128 pre-generated unique fields into a Variant object, in both validated and unvalidated modes. This benchmark-only PR establishes a baseline for the behavior change in #11403, as requested in review. Validation: the benchmark compiled on current Apache main; both cases ran in a short local smoke test. Independent read-only review found no blocking issues. --- parquet-variant/benches/variant_builder.rs | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/parquet-variant/benches/variant_builder.rs b/parquet-variant/benches/variant_builder.rs index 9dbf843586..9ce65b97cf 100644 --- a/parquet-variant/benches/variant_builder.rs +++ b/parquet-variant/benches/variant_builder.rs @@ -505,6 +505,33 @@ fn bench_extend_metadata_builder(c: &mut Criterion) { }); } +fn bench_object_insert_unique_fields(c: &mut Criterion) { + let keys: Vec<_> = (0..128).map(|index| format!("field_{index}")).collect(); + let mut group = c.benchmark_group("object_insert_unique_fields"); + group.throughput(Throughput::Elements(keys.len() as u64)); + + for validate_unique_fields in [false, true] { + let name = if validate_unique_fields { + "validated" + } else { + "unvalidated" + }; + group.bench_function(name, |b| { + b.iter(|| { + let mut builder = + VariantBuilder::new().with_validate_unique_fields(validate_unique_fields); + let mut object = builder.new_object(); + for key in &keys { + object.insert(hint::black_box(key), hint::black_box(42_i32)); + } + object.finish(); + hint::black_box(builder.finish()); + }); + }); + } + group.finish(); +} + criterion_group!( benches, bench_object_field_names_reverse_order, @@ -516,7 +543,8 @@ criterion_group!( bench_object_list_partially_same_schema, bench_validation_validated_vs_unvalidated, bench_iteration_performance, - bench_extend_metadata_builder + bench_extend_metadata_builder, + bench_object_insert_unique_fields ); criterion_main!(benches);
