26 lines
518 B
Rust
26 lines
518 B
Rust
#[macro_use]
|
|
extern crate criterion;
|
|
#[macro_use]
|
|
extern crate eventbus;
|
|
|
|
use criterion::Criterion;
|
|
use eventbus::{Event, EventBus};
|
|
|
|
struct MyEvent {
|
|
}
|
|
|
|
impl Event for MyEvent {
|
|
}
|
|
|
|
fn my_hook(_event: &mut MyEvent) {
|
|
}
|
|
|
|
fn criterion_benchmark(c: &mut Criterion) {
|
|
let bus = EventBus::new();
|
|
register_hook!(&bus, 0, MyEvent, my_hook);
|
|
c.bench_function("one_hook", move |b| b.iter(|| post_event!(&bus, MyEvent, &mut MyEvent {})));
|
|
}
|
|
|
|
criterion_group!(benches, criterion_benchmark);
|
|
criterion_main!(benches);
|