Skip to content

Commit

Permalink
chore: updated benchmark for random dep update
Browse files Browse the repository at this point in the history
  • Loading branch information
pmcgleenon committed Feb 10, 2025
1 parent e185ed2 commit 5e9f50b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ rand = { version = "0.9.0", features = [ "small_rng" ] }
ahash = "0.8.11"
clap = { version = "4.5.19", features = ["derive"] }
priority-queue = "2.1.1"
#gxhash = "3.4.1"
memchr = "2.7.4"
memmap2 = "0.9.5"
thiserror = "2.0.11"
Expand All @@ -33,7 +32,6 @@ thiserror = "2.0.11"
#debug = true

[dev-dependencies]
rand_distr = "0.5.0"
criterion = "0.5.1"
zipf = "7.0.1"

Expand Down
10 changes: 5 additions & 5 deletions benches/topk_add.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use rand_distr::Distribution;
use zipf::ZipfDistribution;
use rand::prelude::*;
use rand::distr::{Distribution, StandardUniform};

use heavykeeper::TopK;

fn benchmark_topk_add(c: &mut Criterion, num_adds: usize) {
let mut rng = rand::thread_rng();
let zipf = ZipfDistribution::new(100_000, 1.03).unwrap();
let mut rng = rand::rng();
let mut topk = TopK::new(10, 1024, 2, 0.95);

let mut data = vec![];
for _ in 0..num_adds {
let key = zipf.sample(&mut rng);
// Generate positive values using abs() of normal distribution
let key = (rng.sample::<f64, StandardUniform>(StandardUniform).abs() * 100_000.0) as u64;
data.push(key);
}

Expand Down

0 comments on commit 5e9f50b

Please sign in to comment.