diff options
author | edef <edef@edef.eu> | 2023-10-28T16·03+0000 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-10-28T17·11+0000 |
commit | ae839983818d69852d733c23794d74933bcfe74e (patch) | |
tree | 6877603b6fc05a126f6dba201296a138a11e057e /tvix/nix-compat/benches | |
parent | 8dfd8bce0484616c3f7b11d2846d95dddc154c1f (diff) |
fix(nix-compat/narinfo): unwrap in the benchmark r/6901
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>
Diffstat (limited to 'tvix/nix-compat/benches')
-rw-r--r-- | tvix/nix-compat/benches/narinfo_parse.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tvix/nix-compat/benches/narinfo_parse.rs b/tvix/nix-compat/benches/narinfo_parse.rs index 974d77b6d78b..7ffd24d12bc3 100644 --- a/tvix/nix-compat/benches/narinfo_parse.rs +++ b/tvix/nix-compat/benches/narinfo_parse.rs @@ -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); }); }); |