chore: add deferred persistence benchmark#1670
Conversation
25a16aa to
461d452
Compare
ec8b9c6 to
56e9247
Compare
461d452 to
f81e3ea
Compare
e8bcb7d to
558e548
Compare
f044ec9 to
e2d972f
Compare
558e548 to
73c824e
Compare
e2d972f to
58d5bb3
Compare
5bcc282 to
dd3d85f
Compare
82dd5fd to
e1e70ce
Compare
dd3d85f to
eea5be4
Compare
e1e70ce to
d54468a
Compare
eea5be4 to
3dcbcc6
Compare
3dcbcc6 to
25321b5
Compare
| fn bench_deferred_persistence<const N: usize, const COMMIT_COUNT: u64>(criterion: &mut Criterion) { | ||
| const KEY_LEN: usize = 4; | ||
| let rng = &firewood_storage::SeededRng::from_option(Some(1234)); | ||
| let commit_count = NonZeroU64::new(COMMIT_COUNT).unwrap(); |
There was a problem hiding this comment.
super nit: nonzero macro would have worked here since it's a compile time constant.
There was a problem hiding this comment.
Unfortunately, applying the nonzero macro here fails as seen below:
generic parameters may not be used in const operations
const parameters may only be used as standalone arguments here, i.e. `COMMIT_COUNT`
firewood/benches/defer_persist.rs
Outdated
| criterion_group! { | ||
| name = benches; | ||
| config = Criterion::default(); | ||
| targets = bench_deferred_persistence::<1_000, 1>, bench_deferred_persistence::<1_000, 100> |
There was a problem hiding this comment.
nit: comment explaining why 1, 100, and 1000 was chosen. I realize we never did this earlier, and maybe there aren't any good reasons :)
There was a problem hiding this comment.
I chose these values on the fly. However, this does call out a good point - these benchmarks could do a better job in showing the performance gain (or loss) from choosing different commit counts. I went ahead and added more benchmark targets to get a performance curve from persisting every commit to persisting just once.
25321b5 to
2ecddcb
Compare
Why this should be merged
Having benchmarks to test the performance of deferred persistence across different commit counts is useful for observability.
How this works
Adds a benchmark
bench_deferred_persistence()to test deferred persistence with commit counts1and100. This benchmark is run daily along with our other benchmarks.How this was tested
CI