From 7de53064798178d65340fb4ce2702439365b790d Mon Sep 17 00:00:00 2001 From: Ruediger Klaehn Date: Tue, 15 Aug 2023 12:45:30 +0200 Subject: [PATCH] just streaming --- tests/interprocess.rs | 2 +- tests/math.rs | 52 +++++++++++++++++++++---------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/tests/interprocess.rs b/tests/interprocess.rs index f142207..f5851bd 100644 --- a/tests/interprocess.rs +++ b/tests/interprocess.rs @@ -162,7 +162,7 @@ async fn quinn_flume_channel_bench() -> anyhow::Result<()> { quic_rpc::transport::quinn::QuinnConnection::new(client, server_addr, "localhost".into()); let client = RpcClient::::new(client); tracing::debug!("Starting benchmark"); - bench(client, 100).await?; + bench(client, 100000).await?; server_handle.abort(); Ok(()) } diff --git a/tests/math.rs b/tests/math.rs index 04a5781..45fec2f 100644 --- a/tests/math.rs +++ b/tests/math.rs @@ -280,32 +280,32 @@ where C::SendError: std::error::Error, { // sequential streaming - { - let t0 = std::time::Instant::now(); - let (send, recv) = client.bidi(Multiply(2)).await?; - let handle = tokio::task::spawn(async move { - let requests = futures::stream::iter((0..n).map(MultiplyUpdate)); - requests.map(Ok).forward(send).await?; - anyhow::Result::<()>::Ok(()) - }); - let mut sum = 0; - tokio::pin!(recv); - let mut i = 0; - while let Some(res) = recv.next().await { - sum += res?.0; - if i % 10000 == 0 { - print!("."); - io::stdout().flush()?; - } - i += 1; - } - assert_eq!(sum, (0..n as u128).map(|x| x * 2).sum()); - let rps = ((n as f64) / t0.elapsed().as_secs_f64()).round(); - clear_line(); - println!("bidi seq {} rps", rps.separate_with_underscores(),); - - handle.await??; - } + // { + // let t0 = std::time::Instant::now(); + // let (send, recv) = client.bidi(Multiply(2)).await?; + // let handle = tokio::task::spawn(async move { + // let requests = futures::stream::iter((0..n).map(MultiplyUpdate)); + // requests.map(Ok).forward(send).await?; + // anyhow::Result::<()>::Ok(()) + // }); + // let mut sum = 0; + // tokio::pin!(recv); + // let mut i = 0; + // while let Some(res) = recv.next().await { + // sum += res?.0; + // if i % 10000 == 0 { + // print!("."); + // io::stdout().flush()?; + // } + // i += 1; + // } + // assert_eq!(sum, (0..n as u128).map(|x| x * 2).sum()); + // let rps = ((n as f64) / t0.elapsed().as_secs_f64()).round(); + // clear_line(); + // println!("bidi seq {} rps", rps.separate_with_underscores(),); + + // handle.await??; + // } // individual RPCs { let mut sum = 0;