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

Improved clippy #1353

Merged
merged 1 commit into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions benches/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,41 @@ fn add_benchmark(c: &mut Criterion) {
let size = 2usize.pow(log2_size);
let arr_a = create_primitive_array::<f32>(size, 0.0);

c.bench_function(&format!("sum 2^{} f32", log2_size), |b| {
c.bench_function(&format!("sum 2^{log2_size} f32"), |b| {
b.iter(|| bench_sum(&arr_a))
});
c.bench_function(&format!("min 2^{} f32", log2_size), |b| {
c.bench_function(&format!("min 2^{log2_size} f32"), |b| {
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| {
c.bench_function(&format!("sum 2^{log2_size} i32"), |b| {
b.iter(|| bench_sum(&arr_a))
});
c.bench_function(&format!("min 2^{} i32", log2_size), |b| {
c.bench_function(&format!("min 2^{log2_size} i32"), |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| {
c.bench_function(&format!("sum null 2^{log2_size} f32"), |b| {
b.iter(|| bench_sum(&arr_a))
});

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

let arr_a = create_string_array::<i32>(1, size, 0.0, 0);

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

let arr_a = create_string_array::<i32>(1, size, 0.1, 0);

c.bench_function(&format!("min null 2^{} utf8", log2_size), |b| {
c.bench_function(&format!("min null 2^{log2_size} utf8"), |b| {
b.iter(|| bench_min(&arr_a))
});
});
Expand Down
6 changes: 3 additions & 3 deletions benches/arithmetic_kernels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ fn add_benchmark(c: &mut Criterion) {
let arr_a = create_primitive_array_with_seed::<u64>(size, 0.0, 43);
let arr_b = create_primitive_array_with_seed::<u64>(size, 0.0, 42);

c.bench_function(&format!("divide_scalar 2^{}", log2_size), |b| {
c.bench_function(&format!("divide_scalar 2^{log2_size}"), |b| {
// 4 is a very fast optimizable divisor
b.iter(|| bench_div_scalar(&arr_a, &4))
});
c.bench_function(&format!("divide_scalar prime 2^{}", log2_size), |b| {
c.bench_function(&format!("divide_scalar prime 2^{log2_size}"), |b| {
// large prime number that is probably harder to simplify
b.iter(|| bench_div_scalar(&arr_a, &524287))
});

c.bench_function(&format!("add 2^{}", log2_size), |b| {
c.bench_function(&format!("add 2^{log2_size}"), |b| {
b.iter(|| bench_add(&arr_a, &arr_b))
});
});
Expand Down
8 changes: 4 additions & 4 deletions benches/assign_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ fn add_benchmark(c: &mut Criterion) {
let size = 2usize.pow(log2_size);

let mut arr_a = create_primitive_array::<f32>(size, 0.2);
c.bench_function(&format!("apply_mul 2^{}", log2_size), |b| {
c.bench_function(&format!("apply_mul 2^{log2_size}"), |b| {
b.iter(|| {
unary(criterion::black_box(&mut arr_a), |x| x * 1.01);
assert!(!arr_a.value(10).is_nan());
})
});

let arr_a = create_primitive_array::<f32>(size, 0.2);
c.bench_function(&format!("mul 2^{}", log2_size), |b| {
c.bench_function(&format!("mul 2^{log2_size}"), |b| {
b.iter(|| {
let a = mul_scalar(criterion::black_box(&arr_a), &1.01f32);
assert!(!a.value(10).is_nan());
Expand All @@ -31,15 +31,15 @@ fn add_benchmark(c: &mut Criterion) {
// convert to be close to 1.01
unary(&mut arr_b, |x| 1.01 + x / 20.0);

c.bench_function(&format!("apply_mul null 2^{}", log2_size), |b| {
c.bench_function(&format!("apply_mul null 2^{log2_size}"), |b| {
b.iter(|| {
binary(criterion::black_box(&mut arr_a), &arr_b, |x, y| x * y);
assert!(!arr_a.value(10).is_nan());
})
});

let arr_a = create_primitive_array::<f32>(size, 0.2);
c.bench_function(&format!("mul null 2^{}", log2_size), |b| {
c.bench_function(&format!("mul null 2^{log2_size}"), |b| {
b.iter(|| {
let a = mul(criterion::black_box(&arr_a), &arr_b);
assert!(!a.value(10).is_nan());
Expand Down
12 changes: 6 additions & 6 deletions benches/bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ fn add_benchmark(c: &mut Criterion) {

let bitmap2 = Bitmap::from_iter((0..size).into_iter().map(|x| x % 3 == 0));

c.bench_function(&format!("bitmap extend aligned 2^{}", log2_size), |b| {
c.bench_function(&format!("bitmap extend aligned 2^{log2_size}"), |b| {
let mut bitmap1 = MutableBitmap::new();
b.iter(|| {
bitmap1.extend_from_bitmap(&bitmap2);
bitmap1.clear();
})
});

c.bench_function(&format!("bitmap extend unaligned 2^{}", log2_size), |b| {
c.bench_function(&format!("bitmap extend unaligned 2^{log2_size}"), |b| {
let mut bitmap1 = MutableBitmap::with_capacity(1);
b.iter(|| {
bitmap1.push(true);
Expand All @@ -28,7 +28,7 @@ fn add_benchmark(c: &mut Criterion) {
});

c.bench_function(
&format!("bitmap extend_constant aligned 2^{}", log2_size),
&format!("bitmap extend_constant aligned 2^{log2_size}"),
|b| {
let mut bitmap1 = MutableBitmap::new();
b.iter(|| {
Expand All @@ -39,7 +39,7 @@ fn add_benchmark(c: &mut Criterion) {
);

c.bench_function(
&format!("bitmap extend_constant unaligned 2^{}", log2_size),
&format!("bitmap extend_constant unaligned 2^{log2_size}"),
|b| {
let mut bitmap1 = MutableBitmap::with_capacity(1);
b.iter(|| {
Expand All @@ -54,14 +54,14 @@ fn add_benchmark(c: &mut Criterion) {
.into_iter()
.map(|x| x % 3 == 0)
.collect::<Vec<_>>();
c.bench_function(&format!("bitmap from_trusted_len 2^{}", log2_size), |b| {
c.bench_function(&format!("bitmap from_trusted_len 2^{log2_size}"), |b| {
b.iter(|| {
MutableBitmap::from_trusted_len_iter(iter.iter().copied());
})
});

c.bench_function(
&format!("bitmap extend_from_trusted_len_iter 2^{}", log2_size),
&format!("bitmap extend_from_trusted_len_iter 2^{log2_size}"),
|b| {
b.iter(|| {
let mut a = MutableBitmap::from(&[true]);
Expand Down
8 changes: 4 additions & 4 deletions benches/bitmap_assign_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ fn add_benchmark(c: &mut Criterion) {
let size = 2usize.pow(log2_size);

let mut bitmap: MutableBitmap = (0..size).into_iter().map(|x| x % 3 == 0).collect();
c.bench_function(&format!("mutablebitmap not 2^{}", log2_size), |b| {
c.bench_function(&format!("mutablebitmap not 2^{log2_size}"), |b| {
b.iter(|| {
unary_assign(criterion::black_box(&mut bitmap), |x: u64| !x);
assert!(!bitmap.is_empty());
})
});

let bitmap: Bitmap = (0..size).into_iter().map(|x| x % 3 == 0).collect();
c.bench_function(&format!("bitmap not 2^{}", log2_size), |b| {
c.bench_function(&format!("bitmap not 2^{log2_size}"), |b| {
b.iter(|| {
let r = !criterion::black_box(&bitmap);
assert!(!r.is_empty());
Expand All @@ -25,7 +25,7 @@ fn add_benchmark(c: &mut Criterion) {

let mut lhs: MutableBitmap = (0..size).into_iter().map(|x| x % 3 == 0).collect();
let rhs: Bitmap = (0..size).into_iter().map(|x| x % 4 == 0).collect();
c.bench_function(&format!("mutablebitmap and 2^{}", log2_size), |b| {
c.bench_function(&format!("mutablebitmap and 2^{log2_size}"), |b| {
b.iter(|| {
binary_assign(criterion::black_box(&mut lhs), &rhs, |x: u64, y| x & y);
assert!(!bitmap.is_empty());
Expand All @@ -34,7 +34,7 @@ fn add_benchmark(c: &mut Criterion) {

let lhs: Bitmap = (0..size).into_iter().map(|x| x % 3 == 0).collect();
let rhs: Bitmap = (0..size).into_iter().map(|x| x % 4 == 0).collect();
c.bench_function(&format!("bitmap and 2^{}", log2_size), |b| {
c.bench_function(&format!("bitmap and 2^{log2_size}"), |b| {
b.iter(|| {
let r = criterion::black_box(&lhs) & &rhs;
assert!(!r.is_empty());
Expand Down
10 changes: 5 additions & 5 deletions benches/bitmap_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn add_benchmark(c: &mut Criterion) {
let size = 2usize.pow(log2_size);

let bitmap: Bitmap = (0..size).into_iter().map(|x| x % 3 == 0).collect();
c.bench_function(&format!("bitmap aligned not 2^{}", log2_size), |b| {
c.bench_function(&format!("bitmap aligned not 2^{log2_size}"), |b| {
b.iter(|| {
let r = !&bitmap;
assert!(r.unset_bits() > 0);
Expand All @@ -23,7 +23,7 @@ fn add_benchmark(c: &mut Criterion) {
let len = ((size as f64) * 0.85) as usize;

c.bench_function(
&format!("bitmap count zeros 85% slice 2^{}", log2_size),
&format!("bitmap count zeros 85% slice 2^{log2_size}"),
|b| {
b.iter(|| {
let r = bitmap.clone().slice(offset, len);
Expand All @@ -36,7 +36,7 @@ fn add_benchmark(c: &mut Criterion) {
let len = ((size as f64) * 0.51) as usize;

c.bench_function(
&format!("bitmap count zeros 51% slice 2^{}", log2_size),
&format!("bitmap count zeros 51% slice 2^{log2_size}"),
|b| {
b.iter(|| {
let r = bitmap.clone().slice(offset, len);
Expand All @@ -46,15 +46,15 @@ fn add_benchmark(c: &mut Criterion) {
);

let bitmap1 = bitmap.clone().slice(1, size - 1);
c.bench_function(&format!("bitmap not 2^{}", log2_size), |b| {
c.bench_function(&format!("bitmap not 2^{log2_size}"), |b| {
b.iter(|| {
let r = !&bitmap1;
assert!(r.unset_bits() > 0);
})
});

let bitmap1: Bitmap = (0..size).into_iter().map(|x| x % 4 == 0).collect();
c.bench_function(&format!("bitmap aligned or 2^{}", log2_size), |b| {
c.bench_function(&format!("bitmap aligned or 2^{log2_size}"), |b| {
b.iter(|| bench_arrow2(&bitmap, &bitmap1))
});
});
Expand Down
8 changes: 4 additions & 4 deletions benches/bitwise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ fn add_benchmark(c: &mut Criterion) {
let arr_a = create_primitive_array_with_seed::<u64>(size, 0.0, 43);
let arr_b = create_primitive_array_with_seed::<u64>(size, 0.0, 42);

c.bench_function(&format!("or 2^{}", log2_size), |b| {
c.bench_function(&format!("or 2^{log2_size}"), |b| {
b.iter(|| bench_or(&arr_a, &arr_b))
});

c.bench_function(&format!("xor 2^{}", log2_size), |b| {
c.bench_function(&format!("xor 2^{log2_size}"), |b| {
b.iter(|| bench_xor(&arr_a, &arr_b))
});

c.bench_function(&format!("and 2^{}", log2_size), |b| {
c.bench_function(&format!("and 2^{log2_size}"), |b| {
b.iter(|| bench_and(&arr_a, &arr_b))
});

c.bench_function(&format!("not 2^{}", log2_size), |b| {
c.bench_function(&format!("not 2^{log2_size}"), |b| {
b.iter(|| bench_not(&arr_a))
});
});
Expand Down
12 changes: 6 additions & 6 deletions benches/comparison_kernels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,30 @@ fn add_benchmark(c: &mut Criterion) {
let arr_a = create_primitive_array_with_seed::<f32>(size, 0.0, 42);
let arr_b = create_primitive_array_with_seed::<f32>(size, 0.0, 43);

c.bench_function(&format!("f32 2^{}", log2_size), |b| {
c.bench_function(&format!("f32 2^{log2_size}"), |b| {
b.iter(|| eq(&arr_a, &arr_b))
});
c.bench_function(&format!("f32 scalar 2^{}", log2_size), |b| {
c.bench_function(&format!("f32 scalar 2^{log2_size}"), |b| {
b.iter(|| eq_scalar(&arr_a, &PrimitiveScalar::<f32>::from(Some(0.5))))
});

let arr_a = create_boolean_array(size, 0.0, 0.1);
let arr_b = create_boolean_array(size, 0.0, 0.2);

c.bench_function(&format!("bool 2^{}", log2_size), |b| {
c.bench_function(&format!("bool 2^{log2_size}"), |b| {
b.iter(|| eq(&arr_a, &arr_b))
});
c.bench_function(&format!("bool scalar 2^{}", log2_size), |b| {
c.bench_function(&format!("bool scalar 2^{log2_size}"), |b| {
b.iter(|| eq_scalar(&arr_a, &BooleanScalar::from(Some(false))))
});

let arr_a = create_string_array::<i32>(size, 4, 0.1, 42);
let arr_b = create_string_array::<i32>(size, 4, 0.1, 43);
c.bench_function(&format!("utf8 2^{}", log2_size), |b| {
c.bench_function(&format!("utf8 2^{log2_size}"), |b| {
b.iter(|| eq(&arr_a, &arr_b))
});

c.bench_function(&format!("utf8 2^{}", log2_size), |b| {
c.bench_function(&format!("utf8 2^{log2_size}"), |b| {
b.iter(|| eq_scalar(&arr_a, &Utf8Scalar::<i32>::from(Some("abc"))))
});
})
Expand Down
8 changes: 4 additions & 4 deletions benches/concatenate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ fn add_benchmark(c: &mut Criterion) {
let array1 = create_primitive_array::<i32>(8, 0.5);
let array2 = create_primitive_array::<i32>(size + 1, 0.5);

c.bench_function(&format!("int32 concat aligned 2^{}", log2_size), |b| {
c.bench_function(&format!("int32 concat aligned 2^{log2_size}"), |b| {
b.iter(|| {
let _ = concatenate(&[&array1, &array2]);
})
});

let array1 = create_primitive_array::<i32>(9, 0.5);

c.bench_function(&format!("int32 concat unaligned 2^{}", log2_size), |b| {
c.bench_function(&format!("int32 concat unaligned 2^{log2_size}"), |b| {
b.iter(|| {
let _ = concatenate(&[&array1, &array2]);
})
Expand All @@ -29,15 +29,15 @@ fn add_benchmark(c: &mut Criterion) {
let array1 = create_boolean_array(8, 0.5, 0.5);
let array2 = create_boolean_array(size + 1, 0.5, 0.5);

c.bench_function(&format!("boolean concat aligned 2^{}", log2_size), |b| {
c.bench_function(&format!("boolean concat aligned 2^{log2_size}"), |b| {
b.iter(|| {
let _ = concatenate(&[&array1, &array2]);
})
});

let array1 = create_boolean_array(9, 0.5, 0.5);

c.bench_function(&format!("boolean concat unaligned 2^{}", log2_size), |b| {
c.bench_function(&format!("boolean concat unaligned 2^{log2_size}"), |b| {
b.iter(|| {
let _ = concatenate(&[&array1, &array2]);
})
Expand Down
4 changes: 2 additions & 2 deletions benches/count_zeros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ fn add_benchmark(c: &mut Criterion) {
.map(|x| 0b01011011u8.rotate_left(x))
.collect::<Vec<_>>();

c.bench_function(&format!("count_zeros 2^{}", log2_size), |b| {
c.bench_function(&format!("count_zeros 2^{log2_size}"), |b| {
b.iter(|| count_zeros(&bytes, 0, bytes.len() * 8))
});

c.bench_function(&format!("count_zeros offset 2^{}", log2_size), |b| {
c.bench_function(&format!("count_zeros offset 2^{log2_size}"), |b| {
b.iter(|| count_zeros(&bytes, 10, bytes.len() * 8 - 10))
});
})
Expand Down
6 changes: 3 additions & 3 deletions benches/filter_kernels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn bench_filter(data_array: &dyn Array, filter_array: &BooleanArray) {
criterion::black_box(filter(data_array, filter_array).unwrap());
}

fn bench_built_filter<'a>(filter: &Filter<'a>, array: &dyn Array) {
fn bench_built_filter(filter: &Filter, array: &dyn Array) {
criterion::black_box(filter(array));
}

Expand All @@ -40,13 +40,13 @@ fn add_benchmark(c: &mut Criterion) {
BooleanArray::new(DataType::Boolean, filter_array.values().clone(), None);

let arr_a = create_primitive_array::<f32>(size, 0.0);
c.bench_function(&format!("filter 2^{} f32", log2_size), |b| {
c.bench_function(&format!("filter 2^{log2_size} f32"), |b| {
b.iter(|| bench_filter(&arr_a, &filter_array))
});

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

c.bench_function(&format!("filter null 2^{} f32", log2_size), |b| {
c.bench_function(&format!("filter null 2^{log2_size} f32"), |b| {
b.iter(|| bench_filter(&arr_a, &filter_array))
});
});
Expand Down
Loading