@@ -13,6 +13,12 @@ fn envelope_json_benchmark(content: &[u8]) -> () {
|
||||
let _ = crunch_envelope::json::unwrap(&out).expect("to be able to unwrap capnp message");
|
||||
}
|
||||
|
||||
fn envelope_proto_benchmark(content: &[u8]) -> () {
|
||||
let out = crunch_envelope::proto::wrap("some-domain", "some-entity", content);
|
||||
|
||||
let _ = crunch_envelope::proto::unwrap(&out).expect("to be able to unwrap capnp message");
|
||||
}
|
||||
|
||||
fn criterion_benchmark(c: &mut Criterion) {
|
||||
let large_content: [u8; 10000] = [0; 10000];
|
||||
|
||||
@@ -22,6 +28,9 @@ fn criterion_benchmark(c: &mut Criterion) {
|
||||
c.bench_function("envelope::json", |b| {
|
||||
b.iter(|| envelope_json_benchmark(&large_content))
|
||||
});
|
||||
c.bench_function("envelope::proto", |b| {
|
||||
b.iter(|| envelope_proto_benchmark(&large_content))
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group!(benches, criterion_benchmark);
|
||||
|
Reference in New Issue
Block a user