fn bitwise_array_benchmark()

in arrow/benches/bitwise_kernel.rs [34:76]


fn bitwise_array_benchmark(c: &mut Criterion) {
    let size = 64 * 1024_usize;
    let left_without_null = create_primitive_array::<Int64Type>(size, 0 as f32);
    let right_without_null = create_primitive_array::<Int64Type>(size, 0 as f32);
    let left_with_null = create_primitive_array::<Int64Type>(size, 0.2_f32);
    let right_with_null = create_primitive_array::<Int64Type>(size, 0.2_f32);
    // array and
    let mut group = c.benchmark_group("bench bitwise array: and");
    group.bench_function("bitwise array and, no nulls", |b| {
        b.iter(|| black_box(bitwise_and(&left_without_null, &right_without_null).unwrap()))
    });
    group.bench_function("bitwise array and, 20% nulls", |b| {
        b.iter(|| black_box(bitwise_and(&left_with_null, &right_with_null).unwrap()))
    });
    group.finish();
    // array or
    let mut group = c.benchmark_group("bench bitwise: or");
    group.bench_function("bitwise array or, no nulls", |b| {
        b.iter(|| black_box(bitwise_or(&left_without_null, &right_without_null).unwrap()))
    });
    group.bench_function("bitwise array or, 20% nulls", |b| {
        b.iter(|| black_box(bitwise_or(&left_with_null, &right_with_null).unwrap()))
    });
    group.finish();
    // xor
    let mut group = c.benchmark_group("bench bitwise: xor");
    group.bench_function("bitwise array xor, no nulls", |b| {
        b.iter(|| black_box(bitwise_xor(&left_without_null, &right_without_null).unwrap()))
    });
    group.bench_function("bitwise array xor, 20% nulls", |b| {
        b.iter(|| black_box(bitwise_xor(&left_with_null, &right_with_null).unwrap()))
    });
    group.finish();
    // not
    let mut group = c.benchmark_group("bench bitwise: not");
    group.bench_function("bitwise array not, no nulls", |b| {
        b.iter(|| black_box(bitwise_not(&left_without_null).unwrap()))
    });
    group.bench_function("bitwise array not, 20% nulls", |b| {
        b.iter(|| black_box(bitwise_not(&left_with_null).unwrap()))
    });
    group.finish();
}