mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-10 06:52:55 +00:00
Add zid stringify bench test
Signed-off-by: Dhammika Pathirana <dhammika@gmail.com>
This commit is contained in:
@@ -37,3 +37,8 @@ bytes = "1.0.1"
|
||||
hex-literal = "0.3"
|
||||
tempfile = "3.2"
|
||||
webpki = "0.21"
|
||||
criterion = "0.3"
|
||||
|
||||
[[bench]]
|
||||
name = "benchmarks"
|
||||
harness = false
|
||||
|
||||
22
zenith_utils/benches/benchmarks.rs
Normal file
22
zenith_utils/benches/benchmarks.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
#![allow(unused)]
|
||||
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use zenith_utils::zid;
|
||||
|
||||
pub fn bench_zid_stringify(c: &mut Criterion) {
|
||||
// Can only use public methods.
|
||||
let ztl = zid::ZTenantTimelineId::generate();
|
||||
|
||||
c.bench_function("zid.to_string", |b| {
|
||||
b.iter(|| {
|
||||
// FIXME measurement overhead?
|
||||
//for _ in 0..1000 {
|
||||
// ztl.tenant_id.to_string();
|
||||
//}
|
||||
ztl.tenant_id.to_string();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group!(benches, bench_zid_stringify);
|
||||
criterion_main!(benches);
|
||||
Reference in New Issue
Block a user