diff --git a/benches/basic.rs b/benches/basic.rs index 20bf944..4456de0 100644 --- a/benches/basic.rs +++ b/benches/basic.rs @@ -27,6 +27,10 @@ fn rand_date() -> (i32, u8, u8) { (y, m, d) } +fn rand_packed() -> i32 { + datealgo::date_to_packed(rand_date()) +} + fn rand_secs() -> i64 { fastrand::i64(datealgo::RD_SECONDS_MIN..=datealgo::RD_SECONDS_MAX) } @@ -77,6 +81,12 @@ fn rand_iwd() -> (i32, u8, u8) { } fn bench_basic(c: &mut Criterion) { + c.bench_function("date_to_packed", |b| { + b.iter_custom(bencher(rand_date, |d| datealgo::date_to_packed(black_box(d)))) + }); + c.bench_function("packed_to_date", |b| { + b.iter_custom(bencher(rand_packed, |p| datealgo::packed_to_date(black_box(p)))) + }); c.bench_function("rd_to_date", |b| { b.iter_custom(bencher(rand_rd, |rd| datealgo::rd_to_date(black_box(rd)))) });