-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finalized massive lineup of models for cardinality benchmark
- Loading branch information
1 parent
4bfc3c2
commit 27a3c99
Showing
13 changed files
with
228 additions
and
119 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 |
---|---|---|
|
@@ -133,3 +133,7 @@ harness = false | |
[[bench]] | ||
name = "hybrid" | ||
harness = false | ||
|
||
[[bench]] | ||
name = "array" | ||
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,52 @@ | ||
//! Benchmark for the methods of the array data structure. | ||
use criterion::{black_box, criterion_group, criterion_main, Criterion}; | ||
use hyperloglog_rs::prelude::*; | ||
|
||
const PRECISION: usize = 15; | ||
const REGISTER_SIZE: usize = 6; | ||
const NUMBER_OF_REGISTERS: usize = 1 << PRECISION; | ||
const NUMBER_OF_REGISTERS_IN_U64: usize = 64 / REGISTER_SIZE; | ||
const PADDED_SIZE: usize = ceil(NUMBER_OF_REGISTERS, NUMBER_OF_REGISTERS_IN_U64); | ||
const PACKED_SIZE: usize = ceil(NUMBER_OF_REGISTERS * REGISTER_SIZE, 64); | ||
|
||
fn bench_array(c: &mut Criterion) { | ||
let mut group = c.benchmark_group("array"); | ||
|
||
group.bench_function("array_insert", |b| { | ||
b.iter(|| { | ||
let mut left = 0; | ||
let mut right = 0; | ||
let mut array: Array<PADDED_SIZE, false, Bits6> = Array::default(); | ||
for i in 0..NUMBER_OF_REGISTERS { | ||
for value in 0..64 { | ||
let (l, r) = array.set_apply(black_box(i), black_box(|x: u8| x.max(value))); | ||
left ^= l; | ||
right ^= r; | ||
} | ||
} | ||
(left, right) | ||
}); | ||
}); | ||
|
||
group.bench_function("packed_insert", |b| { | ||
b.iter(|| { | ||
let mut left = 0; | ||
let mut right = 0; | ||
let mut packed: Array<PACKED_SIZE, true, Bits6> = Array::default(); | ||
for i in 0..NUMBER_OF_REGISTERS { | ||
for value in 0..64 { | ||
let (l, r) = packed.set_apply(black_box(i), black_box(|x: u8| x.max(value))); | ||
left ^= l; | ||
right ^= r; | ||
} | ||
} | ||
(left, right) | ||
}); | ||
}); | ||
|
||
group.finish(); | ||
} | ||
|
||
criterion_group!(benches, bench_array); | ||
|
||
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
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 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.