Skip to content

Commit

Permalink
Clear buffer before serializing to measure size. (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
caibear committed May 5, 2024
1 parent b57786d commit 24c07e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bench_wiring.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use criterion::{black_box, Criterion};
use wiring::prelude::{BufUnWire, BufWire, Unwiring, Wire, Wiring};
use wiring::prelude::{BufUnWire, BufWire, Unwiring, Wiring};

pub fn bench<T: Wiring + Unwiring + PartialEq>(name: &'static str, c: &mut Criterion, data: &T) {
const BUFFER_LEN: usize = 10_000_000;
Expand All @@ -12,7 +12,7 @@ pub fn bench<T: Wiring + Unwiring + PartialEq>(name: &'static str, c: &mut Crite
b.iter(|| black_box(BufWire::new(&mut wire).wire(black_box(data)).unwrap()))
});

wire.sync_wire(data).unwrap();
BufWire::new(&mut wire).wire(data).unwrap();

let buffer = wire.as_slice();

Expand Down

0 comments on commit 24c07e6

Please sign in to comment.