Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions tests/high_concurrency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use bincode_next::config;
use bincode_next::decode_async;
use futures_io::AsyncRead;
use std::pin::Pin;
use std::sync::Arc;
use std::task::Context;
use std::task::Poll;
use std::time::Instant;
Expand All @@ -16,7 +17,7 @@ struct BenchPayload {
}

struct PartialReader {
data: Vec<u8>,
data: Arc<Vec<u8>>,
yields: usize,
pos: usize,
}
Expand Down Expand Up @@ -45,7 +46,7 @@ impl AsyncRead for PartialReader {
}

async fn run_worker(
encoded: Vec<u8>
encoded: Arc<Vec<u8>>
) -> core::result::Result<(), bincode_next::error::DecodeError> {
let reader = PartialReader {
data: encoded,
Expand All @@ -63,7 +64,7 @@ async fn test_high_concurrency() {
id: 123456789,
data: "High concurrency testing payload".to_string(),
};
let encoded = bincode_next::encode_to_vec(&payload, config::standard()).unwrap();
let encoded = Arc::new(bincode_next::encode_to_vec(&payload, config::standard()).unwrap());

let total_tasks: usize = 5_000_000;
let batch_size: usize = 50_000;
Expand Down Expand Up @@ -113,7 +114,7 @@ async fn test_high_concurrency_no_batching() {
id: 123456789,
data: "High concurrency testing payload".to_string(),
};
let encoded = bincode_next::encode_to_vec(&payload, config::standard()).unwrap();
let encoded = Arc::new(bincode_next::encode_to_vec(&payload, config::standard()).unwrap());

let concurrency = 5_000_000;
println!(
Expand Down
Loading