(c: &mut Criterion)
| 47 | } |
| 48 | |
| 49 | fn 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 | |
| 79 | criterion_group!(benches, criterion_benchmark); |
| 80 | criterion_main!(benches); |
nothing calls this directly
no test coverage detected