Skip to content

Commit 2d599e9

Browse files
committed
lib: Move chunk size calc out of the hot path
1 parent 586cd52 commit 2d599e9

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

disktest-lib/src/stream.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,17 @@ fn thread_worker(
7979
return;
8080
}
8181

82+
let chunk_size = generator.get_base_size() * chunk_factor;
83+
8284
// Run the generator work loop.
8385
let mut index = 0;
8486
let mut cur_level = level.load(Ordering::Relaxed);
8587
while !abort.load(Ordering::SeqCst) {
8688
if cur_level < DtStream::MAX_THRES {
8789
// Get the next chunk from the generator.
88-
let size = generator.get_base_size() * chunk_factor;
89-
let mut data = cache_cons.pull(size);
90+
let mut data = cache_cons.pull(chunk_size);
9091
generator.next(&mut data, chunk_factor);
91-
debug_assert_eq!(data.len(), size);
92+
debug_assert_eq!(data.len(), chunk_size);
9293

9394
// Invert the bit pattern, if requested.
9495
if invert_pattern {

0 commit comments

Comments
 (0)