diff --git a/storage/benches/lookups.rs b/storage/benches/lookups.rs index dac7beea72..9140f68661 100644 --- a/storage/benches/lookups.rs +++ b/storage/benches/lookups.rs @@ -97,20 +97,28 @@ fn lookups(c: &mut Criterion) { }) }); - c.bench_function("txs_lookup_by_commitment", |b| { - let tx_commitments = ledger - .storage() - .open_map::<::Commitment, ::TransitionID>(MapId::Commitments) - .unwrap() - .keys() - .collect::>(); + // Commitments are used for multiple lookups. + let tx_commitments = ledger + .storage() + .open_map::<::Commitment, ::TransitionID>(MapId::Commitments) + .unwrap() + .keys() + .collect::>(); + c.bench_function("txs_lookup_by_commitment", |b| { b.iter(|| { let id = tx_commitments.choose(&mut rng).unwrap(); ledger.contains_commitment(id).expect("Lookup by commitment failed"); }) }); + c.bench_function("ciphertext_lookup_by_commitment", |b| { + b.iter(|| { + let id = tx_commitments.choose(&mut rng).unwrap(); + ledger.get_ciphertext(id).expect("Lookup by commitment failed"); + }) + }); + c.bench_function("txs_lookup_by_serial_number", |b| { let tx_serial_numbers = ledger .storage()