fix(nix-compat/narinfo): unwrap in the benchmark
We primarily want to measure the speed of the happy path. Change-Id: Iad0146dde86fc262e2a4b8295bde4eb297b8bf30 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9866 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Autosubmit: edef <edef@edef.eu>
This commit is contained in:
parent
8dfd8bce04
commit
ae83998381
1 changed files with 6 additions and 2 deletions
|
@ -35,7 +35,7 @@ pub fn parse(c: &mut Criterion) {
|
|||
g.throughput(Throughput::Bytes(SAMPLE.len() as u64));
|
||||
g.bench_with_input("single", SAMPLE, |b, data| {
|
||||
b.iter(|| {
|
||||
black_box(NarInfo::parse(black_box(data)));
|
||||
black_box(NarInfo::parse(black_box(data)).ok().unwrap());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -52,7 +52,11 @@ pub fn parse(c: &mut Criterion) {
|
|||
let mut vec = vec![];
|
||||
b.iter(|| {
|
||||
vec.clear();
|
||||
vec.extend(black_box(data).iter().map(|s| NarInfo::parse(s)));
|
||||
vec.extend(
|
||||
black_box(data)
|
||||
.iter()
|
||||
.map(|s| NarInfo::parse(s).ok().unwrap()),
|
||||
);
|
||||
black_box(&vec);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue