Use batch send instead of individual send (#24628)

This commit is contained in:
sakridge 2022-04-27 19:28:16 +02:00 committed by GitHub
parent 27a1757612
commit cdce19be29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -606,12 +606,11 @@ impl<'a> FundingTransactions<'a> for Vec<(&'a Keypair, Transaction)> {
}
fn send<T: BenchTpsClient>(&self, client: &Arc<T>) {
let mut send_txs = Measure::start("send_txs");
self.iter().for_each(|(_, tx)| {
client.send_transaction(tx.clone()).expect("transfer");
});
let mut send_txs = Measure::start("send_and_clone_txs");
let batch: Vec<_> = self.iter().map(|(_keypair, tx)| tx.clone()).collect();
client.send_batch(batch).expect("transfer");
send_txs.stop();
debug!("send {} txs: {}us", self.len(), send_txs.as_us());
debug!("send {} {}", self.len(), send_txs);
}
fn verify<T: 'static + BenchTpsClient + Send + Sync>(