Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Improved bench
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao committed Mar 5, 2022
1 parent 3b55eeb commit 4d0fe7b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions benches/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use arrow2::array::*;
use arrow2::compute::aggregate::*;
use arrow2::util::bench_util::*;

fn bench_sum(arr_a: &PrimitiveArray<f32>) {
fn bench_sum(arr_a: &dyn Array) {
sum(criterion::black_box(arr_a)).unwrap();
}

fn bench_min(arr_a: &PrimitiveArray<f32>) {
min_primitive(criterion::black_box(arr_a)).unwrap();
fn bench_min(arr_a: &dyn Array) {
min(criterion::black_box(arr_a)).unwrap();
}

fn add_benchmark(c: &mut Criterion) {
Expand All @@ -24,6 +24,15 @@ fn add_benchmark(c: &mut Criterion) {
b.iter(|| bench_min(&arr_a))
});

let arr_a = create_primitive_array::<i32>(size, 0.0);

c.bench_function(&format!("sum 2^{} i32", log2_size), |b| {
b.iter(|| bench_sum(&arr_a))
});
c.bench_function(&format!("min 2^{} i32", log2_size), |b| {
b.iter(|| bench_min(&arr_a))
});

let arr_a = create_primitive_array::<f32>(size, 0.1);

c.bench_function(&format!("sum null 2^{} f32", log2_size), |b| {
Expand Down

0 comments on commit 4d0fe7b

Please sign in to comment.