|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
use criterion::Criterion;
|
|
|
|
|
use criterion::{black_box, BenchmarkId, Throughput};
|
|
|
|
|
use criterion::{criterion_group, criterion_main};
|
|
|
|
|
use criterion::{BatchSize, Criterion};
|
|
|
|
|
use std::io::Cursor;
|
|
|
|
|
|
|
|
|
|
use rmp_ipc::event::Event;
|
|
|
|
@ -19,13 +19,19 @@ fn event_deserialization(c: &mut Criterion) {
|
|
|
|
|
let runtime = Runtime::new().unwrap();
|
|
|
|
|
let mut group = c.benchmark_group("event_deserialization");
|
|
|
|
|
|
|
|
|
|
for size in (0..32).map(|i| i * 1024) {
|
|
|
|
|
group.throughput(Throughput::Bytes(size));
|
|
|
|
|
for size in (0..10)
|
|
|
|
|
.step_by(2)
|
|
|
|
|
.map(|i| 1024 * 2u32.pow(i as u32) as usize)
|
|
|
|
|
{
|
|
|
|
|
group.throughput(Throughput::Bytes(size as u64));
|
|
|
|
|
group.bench_with_input(BenchmarkId::from_parameter(size), &size, |b, &size| {
|
|
|
|
|
b.to_async(&runtime).iter(|| async {
|
|
|
|
|
let mut reader = black_box(create_event_bytes_reader(size as usize));
|
|
|
|
|
Event::from_async_read(&mut reader).await.unwrap()
|
|
|
|
|
})
|
|
|
|
|
b.to_async(&runtime).iter_batched(
|
|
|
|
|
|| black_box(create_event_bytes_reader(size)),
|
|
|
|
|
|mut reader| async move {
|
|
|
|
|
Event::from_async_read(&mut reader).await.unwrap();
|
|
|
|
|
},
|
|
|
|
|
BatchSize::LargeInput,
|
|
|
|
|
)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
group.finish()
|
|
|
|
|