From a7507e60ce679a29fa6158e2a141ad7f1674c126 Mon Sep 17 00:00:00 2001 From: "TAKASE Ryo (loloicci)" Date: Sun, 28 Jul 2024 00:45:07 +0900 Subject: [PATCH] book: fix an example of throughput measurements (#773) * fix an example of throughput measurements * fix lambda's arg order in an example --- book/src/user_guide/advanced_configuration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/src/user_guide/advanced_configuration.md b/book/src/user_guide/advanced_configuration.md index d7be9bca6..4f5290055 100644 --- a/book/src/user_guide/advanced_configuration.md +++ b/book/src/user_guide/advanced_configuration.md @@ -100,8 +100,8 @@ fn bench(c: &mut Criterion) { let mut group = c.benchmark_group("throughput-example"); for (i, elements) in [elements_1, elements_2].iter().enumerate() { - group.throughput(Throughput::Elements(elems.len() as u64)); - group.bench_with_input(format!("Encode {}", i), elements, |elems, b| { + group.throughput(Throughput::Elements(elements.len() as u64)); + group.bench_with_input(format!("Encode {}", i), elements, |b, elems| { b.iter(||encode(elems)) }); }