Skip to content

Commit

Permalink
perf: Add benchmark of ArchivalMMR's get_peaks
Browse files Browse the repository at this point in the history
Cf. #125.
  • Loading branch information
Sword-Smith committed Apr 22, 2024
1 parent c6e76f3 commit 081acaa
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions benches/archival_mmr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,29 @@ mod batch_mutate_leaf_and_update_mps {
}
}
}

mod get_peaks {
use super::*;

mod get_peaks_of_about_1m {
use super::*;

const AMMR_LEAF_COUNT: u64 = 1_001_003;

fn get_peaks_impl(bencher: Bencher) {
let rt = tokio::runtime::Runtime::new().unwrap();
let (_, ammr) = rt.block_on(new_ammr(AMMR_LEAF_COUNT));

bencher.bench_local(|| {
rt.block_on(async {
ammr.get_peaks().await;
});
});
}

#[divan::bench]
fn get_peaks(bencher: Bencher) {
get_peaks_impl(bencher);
}
}
}

0 comments on commit 081acaa

Please sign in to comment.