Skip to content

Commit f3c9350

Browse files
dlachaumesfauvel
authored andcommitted
Generate transactions before running bench
1 parent 45829aa commit f3c9350

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

mithril-aggregator/benches/cardano_transactions_import.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,25 @@ fn generate_transactions(nb_transactions: usize) -> Vec<CardanoTransaction> {
3939
}
4040

4141
fn bench_store_transactions(c: &mut Criterion) {
42-
const NB_CARDANO_TRANSACTIONS: usize = 100000;
42+
const NB_CARDANO_TRANSACTIONS: usize = 1_000_000;
4343
let runtime = tokio::runtime::Runtime::new().unwrap();
44+
let transactions = generate_transactions(NB_CARDANO_TRANSACTIONS);
4445

4546
let mut group = c.benchmark_group("Store transactions");
4647
group.bench_function("store_transactions", |bencher| {
4748
bencher.to_async(&runtime).iter(|| async {
4849
let connection = Arc::new(cardano_tx_db_connection());
4950
let repository = CardanoTransactionRepository::new(connection);
50-
repository
51-
.store_transactions(generate_transactions(NB_CARDANO_TRANSACTIONS))
52-
.await
51+
repository.store_transactions(transactions.clone()).await
5352
});
5453
});
5554

5655
group.finish();
5756
}
5857

59-
criterion_group!(benches, bench_store_transactions);
58+
criterion_group! {
59+
name = benches;
60+
config = Criterion::default().sample_size(10);
61+
targets = bench_store_transactions
62+
}
6063
criterion_main!(benches);

0 commit comments

Comments
 (0)