Skip to content

Commit

Permalink
use fastrand
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Aug 13, 2024
1 parent 11e0ddf commit 7a40d7f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 43 deletions.
39 changes: 1 addition & 38 deletions runners/s3-benchrunner-rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion runners/s3-benchrunner-rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ serde = { version = "1.0.204", features = ["derive"] }
serde_json = "1.0.120"
thiserror = "1.0.62"
tokio = { version = "1.38.1", features = ["io-util"] }
rand = "0.8.4"
bytes = "1"
fastrand = "=2.1.0"
7 changes: 3 additions & 4 deletions runners/s3-benchrunner-rust/src/transfer_manager.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::sync::Arc;
use std::{iter::repeat_with, sync::Arc};

use anyhow::Context;
use async_trait::async_trait;
Expand Down Expand Up @@ -56,9 +56,8 @@ impl TransferManagerRunner {
.unwrap()
};
let random_data_for_upload: Bytes = {
// TODO: More efficient way to generate random buffer
let mut data = Vec::new();
data.resize_with(upload_data_size, rand::random::<u8>);
let mut rng = fastrand::Rng::new();
let data: Vec<u8> = repeat_with(|| rng.u8(..)).take(10_000).collect();
data.into()
};

Expand Down

0 comments on commit 7a40d7f

Please sign in to comment.