Skip to content

Commit

Permalink
bench: use one-shot rngs without periodic reseeding
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdroychan committed Feb 6, 2025
1 parent 4fd8f81 commit df03d23
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use hdrhistogram::Histogram;
use log::debug;
use parking_lot::Mutex;
use quanta::Instant;
use rand::SeedableRng;
use serde::Deserialize;
use std::rc::Rc;
use std::sync::atomic::{AtomicU64, Ordering};
Expand Down Expand Up @@ -693,7 +694,7 @@ fn bench_worker_regular(map: Arc<Box<dyn KVMap>>, context: WorkerContext) {
};

let mut handle = map.handle();
let mut rng = rand::thread_rng();
let mut rng = rand::rngs::StdRng::from_entropy();
let mut workload = Workload::new(&benchmark.wopt, Some(thread_info));
let start = Instant::now();

Expand Down Expand Up @@ -810,7 +811,7 @@ fn bench_worker_async(map: Arc<Box<dyn AsyncKVMap>>, context: WorkerContext) {

let responder = Rc::new(RefCell::new(Vec::<Response>::new()));
let mut handle = map.handle(responder.clone());
let mut rng = rand::thread_rng();
let mut rng = rand::rngs::StdRng::from_entropy();
let mut workload = Workload::new(&benchmark.wopt, Some(thread_info));
// pending requests is global, as it is not needed to drain all requests after each repeat
let mut pending = 0usize;
Expand Down

0 comments on commit df03d23

Please sign in to comment.