aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tests/prime_sieve/benches/main.rs11
-rw-r--r--src/tests/prime_sieve/src/lib.rs2
-rw-r--r--src/tests/prime_sieve/src/types.pr.rs2
3 files changed, 10 insertions, 5 deletions
diff --git a/src/tests/prime_sieve/benches/main.rs b/src/tests/prime_sieve/benches/main.rs
index fd04578..a055c26 100644
--- a/src/tests/prime_sieve/benches/main.rs
+++ b/src/tests/prime_sieve/benches/main.rs
@@ -3,10 +3,13 @@ use criterion::Criterion;
use criterion::{criterion_group, criterion_main};
fn bench_sieve(c: &mut Criterion) {
- let size: usize = 10;
- c.bench_with_input(BenchmarkId::new("prime_sieve", size), &size, |b, &n| {
- b.iter(|| prime_sieve::prime_sieve(n));
- });
+ let mut group = c.benchmark_group("prime_sieve");
+ group.sample_size(20);
+ for size in [10_000, 20_000, 50_000].iter() {
+ group.bench_with_input(BenchmarkId::new("prime_sieve", size), size, |b, &n| {
+ b.iter(|| prime_sieve::prime_sieve(n));
+ });
+ }
}
criterion_group!(benches, bench_sieve);
diff --git a/src/tests/prime_sieve/src/lib.rs b/src/tests/prime_sieve/src/lib.rs
index 8d53e30..788e804 100644
--- a/src/tests/prime_sieve/src/lib.rs
+++ b/src/tests/prime_sieve/src/lib.rs
@@ -3,6 +3,8 @@
mod types;
use types::*;
+use primrose_library::traits::{Container, Stack};
+
/// Find all primes < `n` using the sieve of eratosthenes
pub fn prime_sieve(n: usize) -> Primes<usize> {
// Add numbers to sieve through
diff --git a/src/tests/prime_sieve/src/types.pr.rs b/src/tests/prime_sieve/src/types.pr.rs
index 2006302..a7f04bf 100644
--- a/src/tests/prime_sieve/src/types.pr.rs
+++ b/src/tests/prime_sieve/src/types.pr.rs
@@ -9,5 +9,5 @@ property ascending<T> {
type Sieve<S> = {c impl (Container, Stack) | (lifo c)}
-type Primes<S> = {c impl (Container, Stack) | (ascending c)}
+type Primes<S> = {c impl (Container) | (ascending c)}
*ENDSPEC*/