This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved performance of unary _not_ for aligned bitmaps (3x) (#365)
* Added benches for bitmap unary. * Improved perf of binary unary op.
- Loading branch information
1 parent
088ed56
commit 2e81a8b
Showing
5 changed files
with
70 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,3 +183,7 @@ harness = false | |
[[bench]] | ||
name = "concat" | ||
harness = false | ||
|
||
[[bench]] | ||
name = "bitmap_ops" | ||
harness = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use arrow2::bitmap::Bitmap; | ||
|
||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
|
||
fn bench_arrow2(lhs: &Bitmap, rhs: &Bitmap) { | ||
let r = lhs | rhs; | ||
assert!(r.null_count() > 0); | ||
} | ||
|
||
fn add_benchmark(c: &mut Criterion) { | ||
(10..=20).step_by(2).for_each(|log2_size| { | ||
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| { | ||
b.iter(|| { | ||
let r = !&bitmap; | ||
assert!(r.null_count() > 0); | ||
}) | ||
}); | ||
let bitmap1 = bitmap.clone().slice(1, size - 1); | ||
c.bench_function(&format!("bitmap not 2^{}", log2_size), |b| { | ||
b.iter(|| { | ||
let r = !&bitmap1; | ||
assert!(r.null_count() > 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| { | ||
b.iter(|| bench_arrow2(&bitmap, &bitmap1)) | ||
}); | ||
}); | ||
} | ||
|
||
criterion_group!(benches, add_benchmark); | ||
criterion_main!(benches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters