Skip to content

Commit

Permalink
just streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
rklaehn committed Aug 15, 2023
1 parent bdda5da commit 7de5306
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion tests/interprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<ComputeService, _>::new(client);
tracing::debug!("Starting benchmark");
bench(client, 100).await?;
bench(client, 100000).await?;
server_handle.abort();
Ok(())
}
Expand Down
52 changes: 26 additions & 26 deletions tests/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7de5306

Please sign in to comment.