Skip to content

Commit 1ae54b5

Browse files
authored
Benchmark unsigned 64-bit multiplication (#9211)
Adds a `mul_u64_nonnull` case to `binary_ops`. The suite covers `Mul` at every signed width and at `u8`, `u16` and `u32`, but not at `u64`, which takes a different overflow check because it has no wider native type to widen into. This lands separately so that CodSpeed records a baseline on `develop` before #9210 changes that check. Measured on that PR, the width gains 1.8x, which no existing benchmark would have caught. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
1 parent 26465e7 commit 1ae54b5

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

vortex-array/benches/binary_ops.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ fn mul_u32_nonnull(bencher: Bencher) {
134134
bench_primitive(bencher, lhs, rhs, Operator::Mul);
135135
}
136136

137+
#[divan::bench]
138+
fn mul_u64_nonnull(bencher: Bencher) {
139+
let lhs = primitive_u64_small_nonnull(1).into_array();
140+
let rhs = primitive_u64_small_nonnull(17).into_array();
141+
142+
bench_primitive(bencher, lhs, rhs, Operator::Mul);
143+
}
144+
137145
#[divan::bench]
138146
fn mul_i32_nullable(bencher: Bencher) {
139147
let lhs = primitive_i32_small_nullable(1, 7).into_array();
@@ -286,6 +294,10 @@ fn primitive_u32_small_nonnull(offset: u32) -> PrimitiveArray {
286294
PrimitiveArray::from_iter((0..LEN).map(|i| ((i + offset as usize) % 4096 + 1) as u32))
287295
}
288296

297+
fn primitive_u64_small_nonnull(offset: u64) -> PrimitiveArray {
298+
PrimitiveArray::from_iter((0..LEN).map(|i| ((i + offset as usize) % 4096 + 1) as u64))
299+
}
300+
289301
fn primitive_nonzero() -> PrimitiveArray {
290302
PrimitiveArray::from_iter((0..LEN as i64).map(|i| (i % 255) + 1))
291303
}

0 commit comments

Comments
 (0)