Skip to main content

event_store_benchmarks

Macro event_store_benchmarks 

macro_rules! event_store_benchmarks {
    (
        mod_name = $mod_name:ident,
        emit = $emit:path,
        params = $params:expr,
        fixture = $fixture:expr
    ) => { ... };
    (mod_name = $mod_name:ident, emit = $emit:path, fixture = $fixture:expr) => { ... };
    (mod_name = $mod_name:ident, params = $params:expr, fixture = $fixture:expr) => { ... };
    (mod_name = $mod_name:ident, fixture = $fixture:expr) => { ... };
    ($fixture:expr) => { ... };
}
Available on crate feature bench only.
Expand description

Generates the benchmark harness for an event store adapter.

Not conformance. Nothing this expands to is a conformance rule, no adapter’s bar moves because it exists, and no result it produces can fail a merge (CF-34). It is inherited exactly as conformance is — one line against the fixture you already wrote — and it imposes no measurement dependency on you (CF-23): the per-scenario wrapper, and with it the clock, is the emit parameter.

Behind the off-by-default bench feature, and absent on wasm32-unknown-unknown. Gate your invocation as this crate’s own tests/memory_benchmarks.rs does.

§Examples

use happenstance_testkit::fixtures::MemoryFixture;

happenstance_testkit::event_store_benchmarks!(MemoryFixture::new());

Your own workload sizes, and your own emitter — which is where a timer, a warm-up, a repetition count and a criterion dependency all belong:

happenstance_testkit::event_store_benchmarks!(
    mod_name = sqlite_benchmarks,
    emit = my_timed_emitter,
    params = happenstance_testkit::bench::BenchmarkParams::new(256, 64, 100_000),
    fixture = SqliteFixture::new()
);