From e47b25eff7273054934f4e4d9c400c37572cc413 Mon Sep 17 00:00:00 2001 From: Andre da Silva Date: Tue, 19 Nov 2024 17:46:11 -0300 Subject: [PATCH] Share tokio runtime --- linera-service/benches/transfers.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/linera-service/benches/transfers.rs b/linera-service/benches/transfers.rs index f17e23eed832..c4c500deda78 100644 --- a/linera-service/benches/transfers.rs +++ b/linera-service/benches/transfers.rs @@ -2,10 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use criterion::{criterion_group, criterion_main, Criterion}; -use futures::{ - stream::{self, FuturesUnordered}, - Stream, StreamExt, -}; +use futures::{stream::FuturesUnordered, Stream, StreamExt}; use linera_base::{ data_types::Amount, identifiers::{Account, ChainId, Owner}, @@ -20,10 +17,11 @@ fn cross_chain_native_token_transfers(criterion: &mut Criterion) { let chain_count = 100; let accounts_per_chain = 1; let transfers_per_account = 100; + let runtime = Runtime::new().expect("Failed to create Tokio runtime"); criterion.bench_function("same_chain_native_token_transfers", |bencher| { bencher - .to_async(Runtime::new().expect("Failed to create Tokio runtime")) + .to_async(&runtime) .iter_custom(|iterations| async move { let mut total_time = Duration::ZERO;