MCPcopy Create free account
hub / github.com/apache/arrow-rs / criterion_benchmark

Function criterion_benchmark

arrow-array/benches/union_array.rs:49–77  ·  view source on GitHub ↗
(c: &mut Criterion)

Source from the content-addressed store, hash-verified

47}
48
49fn criterion_benchmark(c: &mut Criterion) {
50 for with_nulls in 1..12 {
51 for without_nulls in [0, 1, 10] {
52 c.bench_function(
53 &format!("union logical nulls 4096 {with_nulls} children with nulls, {without_nulls} without nulls"),
54 |b| {
55 let type_ids = 0..with_nulls+without_nulls;
56
57 let fields = UnionFields::try_new(
58 type_ids.clone(),
59 type_ids.clone().map(|i| Field::new(format!("f{i}"), DataType::Int32, true)),
60 ).unwrap();
61
62 let array = UnionArray::try_new(
63 fields,
64 type_ids.cycle().take(4096).collect(),
65 None,
66 std::iter::repeat_n(array_with_nulls(), with_nulls as usize)
67 .chain(std::iter::repeat_n(array_without_nulls(), without_nulls as usize))
68 .collect(),
69 )
70 .unwrap();
71
72 b.iter(|| hint::black_box(array.logical_nulls()))
73 },
74 );
75 }
76 }
77}
78
79criterion_group!(benches, criterion_benchmark);
80criterion_main!(benches);

Callers

nothing calls this directly

Calls 8

try_newFunction · 0.85
array_with_nullsFunction · 0.85
array_without_nullsFunction · 0.85
collectMethod · 0.80
cloneMethod · 0.45
takeMethod · 0.45
iterMethod · 0.45
logical_nullsMethod · 0.45

Tested by

no test coverage detected