Skip to content

Commit

Permalink
chore: added M8192 tests & benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
pmcgleenon authored and Licenser committed Dec 6, 2024
1 parent 43833b5 commit 9c29541
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 3 deletions.
19 changes: 19 additions & 0 deletions benches/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ fn bench_ulysses(c: &mut Criterion) {
}
});
});
group.bench_with_input("HyperTwoBits<8192>", &lines, |b, lines| {
let mut counter = HyperTwoBits::<h2b::M8192>::default();
b.iter(|| {
// for line in lines.chunks_exact(4) {
// counter.insert4(&line[0], &line[1], &line[2], &line[3]);
// }
for line in lines {
counter.insert(line);
}
});
});
group.bench_with_input("HyperThreeBits<64>", &lines, |b, lines| {
let mut counter = HyperThreeBits::<h3b::M64>::default();
b.iter(|| {
Expand Down Expand Up @@ -190,6 +201,14 @@ fn bench_ulysses(c: &mut Criterion) {
}
});
});
group.bench_with_input("HyperThreeBits<8192>", &lines, |b, lines| {
let mut counter = HyperThreeBits::<h3b::M8192>::default();
b.iter(|| {
for line in lines {
counter.insert(line);
}
});
});

group.finish();
}
Expand Down
2 changes: 1 addition & 1 deletion src/h2b.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod tests;

use std::hash::BuildHasher;

pub use sketch::{Sketch, M1024, M128, M2048, M256, M4096, M512, M64};
pub use sketch::{Sketch, M1024, M128, M2048, M256, M4096, M512, M64, M8192};

use crate::AHasherDefaultBuilder;

Expand Down
4 changes: 4 additions & 0 deletions src/h2b/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ fn htb2048_size() {
fn htb4096_size() {
assert_eq!(std::mem::size_of::<HyperTwoBits<super::M4096>>(), 1040);
}
#[test]
fn htb8192_size() {
assert_eq!(std::mem::size_of::<HyperTwoBits<super::M8192>>(), 2064);
}

#[allow(
clippy::cast_precision_loss,
Expand Down
2 changes: 1 addition & 1 deletion src/h3b.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod tests;

use std::hash::BuildHasher;

pub use sketch::{Sketch, M1024, M128, M2048, M256, M4096, M512, M64};
pub use sketch::{Sketch, M1024, M128, M2048, M256, M4096, M512, M64, M8192};

use crate::AHasherDefaultBuilder;

Expand Down
6 changes: 5 additions & 1 deletion src/h3b/sketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ impl Sketch for M4096 {
}
}

/// M = 4096 Sketch Implementation
/// M = M8192 Sketch Implementation
pub type M8192 = M128Reg<64>;

impl Sketch for M8192 {
Expand Down Expand Up @@ -606,4 +606,8 @@ mod tests {
fn test_m4096() {
test::<M4096>();
}
#[test]
fn test_m8192() {
test::<M8192>();
}
}
4 changes: 4 additions & 0 deletions src/h3b/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ fn htb2048_size() {
fn htb4096_size() {
assert_eq!(std::mem::size_of::<HyperThreeBits<super::M4096>>(), 1552);
}
#[test]
fn htb8192_size() {
assert_eq!(std::mem::size_of::<HyperThreeBits<super::M8192>>(), 3088);
}

#[allow(
clippy::cast_precision_loss,
Expand Down

0 comments on commit 9c29541

Please sign in to comment.