about summary refs log tree commit diff
path: root/tvix/nix-compat/benches
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2023-10-28T16·03+0000
committerclbot <clbot@tvl.fyi>2023-10-28T17·11+0000
commitae839983818d69852d733c23794d74933bcfe74e (patch)
tree6877603b6fc05a126f6dba201296a138a11e057e /tvix/nix-compat/benches
parent8dfd8bce0484616c3f7b11d2846d95dddc154c1f (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.rs8
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);
             });
         });