-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
1,351 additions
and
4,951 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
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
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 was deleted.
Oops, something went wrong.
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,46 @@ | ||
use criterion::{BenchmarkId, Criterion, Throughput}; | ||
use narrow::bitmap::Bitmap; | ||
use rand::{prelude::StdRng, Rng, SeedableRng}; | ||
|
||
pub(super) fn bench(c: &mut Criterion) { | ||
{ | ||
let mut group = c.benchmark_group("Bitmap::from_iter"); | ||
let mut rng = StdRng::seed_from_u64(1234); | ||
|
||
for size in [12345] { | ||
for null_fraction in [0., 0.1, 0.5, 0.9, 1.] { | ||
let input = (0..size) | ||
.into_iter() | ||
.map(|_| rng.gen_bool(1. - null_fraction)) | ||
.collect::<Vec<_>>(); | ||
group.throughput(Throughput::Elements(size as u64)); | ||
group.bench_with_input( | ||
BenchmarkId::new("narrow", format!("{}/{}", size, null_fraction)), | ||
&input, | ||
|b, input| b.iter(|| Bitmap::<Vec<u8>>::from_iter(input)), | ||
); | ||
} | ||
} | ||
} | ||
|
||
{ | ||
let mut group = c.benchmark_group("Bitmap::into_iter"); | ||
let mut rng = StdRng::seed_from_u64(1234); | ||
|
||
for size in [12345] { | ||
for null_fraction in [0., 0.1, 0.5, 0.9, 1.] { | ||
let input = (0..size) | ||
.into_iter() | ||
.map(|_| rng.gen_bool(1. - null_fraction)) | ||
.collect::<Vec<_>>(); | ||
let narrow_bitmap = Bitmap::<Vec<u8>>::from_iter(&input); | ||
group.throughput(Throughput::Elements(size as u64)); | ||
group.bench_with_input( | ||
BenchmarkId::new("narrow", format!("{}/{}", size, null_fraction)), | ||
&narrow_bitmap, | ||
|b, input| b.iter(|| Vec::<bool>::from_iter(input)), | ||
); | ||
} | ||
} | ||
} | ||
} |
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,7 @@ | ||
use criterion::Criterion; | ||
|
||
mod iter; | ||
|
||
pub(super) fn bench(c: &mut Criterion) { | ||
iter::bench(c); | ||
} |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
|
||
mod array; | ||
mod bitmap; | ||
|
||
criterion_group! { | ||
name = narrow; | ||
config = Criterion::default(); | ||
targets = | ||
array::bench | ||
bitmap::bench | ||
} | ||
criterion_main!(narrow); |
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
Oops, something went wrong.