diff --git a/tests/high_concurrency.rs b/tests/high_concurrency.rs index eb6833c..9af7d07 100644 --- a/tests/high_concurrency.rs +++ b/tests/high_concurrency.rs @@ -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; @@ -16,7 +17,7 @@ struct BenchPayload { } struct PartialReader { - data: Vec, + data: Arc>, yields: usize, pos: usize, } @@ -45,7 +46,7 @@ impl AsyncRead for PartialReader { } async fn run_worker( - encoded: Vec + encoded: Arc> ) -> core::result::Result<(), bincode_next::error::DecodeError> { let reader = PartialReader { data: encoded, @@ -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; @@ -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!(