From 1f86cadf237c0ba2ccbe71dd91d7a09e8045b9bd Mon Sep 17 00:00:00 2001 From: Garrett T Date: Sun, 14 Mar 2021 09:35:43 -0700 Subject: [PATCH] Add Apple M1 arm as a benchmark (#18) --- README.md | 1 + benches/benchmarks.rs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4726743..565f0fa 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ You can run them with `cargo test` and `cargo bench`. | ----------------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | | Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz | [1.4321 us 1.4339 us 1.4357 us] | [1.3385 ns 1.3456 ns 1.3552 ns] | [228.77 us 232.17 us 236.23 us] | [24.688 ns 25.083 ns 25.551 ns] | [22.832 ns 22.910 ns 22.995 ns] | | Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz | [1.3439 us 1.3499 us 1.3562 us] | [1.5416 ns 1.5446 ns 1.5481 ns] | [197.46 us 198.37 us 199.22 us] | [20.455 ns 20.486 ns 20.518 ns] | [18.726 ns 18.850 ns 18.993 ns] | +| Apple M1 ARM (Macbook Air) | [3.3367 us 3.3629 us 3.4058 us] | [741.75 ps 742.65 ps 743.52 ps] | [210.14 us 210.23 us 210.34 us] | [27.567 ns 27.602 ns 27.650 ns] | [26.716 ns 26.735 ns 26.755 ns] | # Contributing diff --git a/benches/benchmarks.rs b/benches/benchmarks.rs index 2e2d60a..b80eb17 100644 --- a/benches/benchmarks.rs +++ b/benches/benchmarks.rs @@ -1,4 +1,5 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion}; +use std::convert::TryFrom; use sharks::{Share, Sharks}; @@ -24,10 +25,10 @@ fn recover(c: &mut Criterion) { fn share(c: &mut Criterion) { let bytes_vec = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; let bytes = bytes_vec.as_slice(); - let share = Share::from(bytes); + let share = Share::try_from(bytes).unwrap(); c.bench_function("share_from_bytes", |b| { - b.iter(|| Share::from(black_box(bytes))) + b.iter(|| Share::try_from(black_box(bytes))) }); c.bench_function("share_to_bytes", |b| {