summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--benches/bench_sm.rs43
1 files changed, 22 insertions, 21 deletions
diff --git a/benches/bench_sm.rs b/benches/bench_sm.rs
index 736397a..25dd3cc 100644
--- a/benches/bench_sm.rs
+++ b/benches/bench_sm.rs
@@ -7,7 +7,8 @@ use rand::{
thread_rng,
};
-use sort::sm;
+#[allow(unused_imports)]
+use sort::{sm, smi};
fn bench_10(c: &mut Criterion) {
let mut rng = thread_rng();
@@ -19,10 +20,10 @@ fn bench_10(c: &mut Criterion) {
assert_eq!(input.len(), 10);
- c.bench_function("sm", |b| {
+ c.bench_function("smi", |b| {
b.iter(|| {
let mut count = 0;
- black_box(sm(input.as_slice(), &mut count))
+ black_box(smi(input.as_slice(), &mut count))
})
});
}
@@ -37,67 +38,67 @@ fn bench_20(c: &mut Criterion) {
assert_eq!(input.len(), 20);
- c.bench_function("sm", |b| {
+ c.bench_function("smi", |b| {
b.iter(|| {
let mut count = 0;
- black_box(sm(input.as_slice(), &mut count))
+ black_box(smi(input.as_slice(), &mut count))
})
});
}
-fn bench_30(c: &mut Criterion) {
+fn bench_40(c: &mut Criterion) {
let mut rng = thread_rng();
let input = {
let uniform = Uniform::new(-100.0f32, 100.0f32);
- uniform.sample_iter(&mut rng).take(30).collect::<Vec<_>>()
+ uniform.sample_iter(&mut rng).take(40).collect::<Vec<_>>()
};
- assert_eq!(input.len(), 30);
+ assert_eq!(input.len(), 40);
- c.bench_function("sm", |b| {
+ c.bench_function("smi", |b| {
b.iter(|| {
let mut count = 0;
- black_box(sm(input.as_slice(), &mut count))
+ black_box(smi(input.as_slice(), &mut count))
})
});
}
-fn bench_40(c: &mut Criterion) {
+fn bench_80(c: &mut Criterion) {
let mut rng = thread_rng();
let input = {
let uniform = Uniform::new(-100.0f32, 100.0f32);
- uniform.sample_iter(&mut rng).take(40).collect::<Vec<_>>()
+ uniform.sample_iter(&mut rng).take(80).collect::<Vec<_>>()
};
- assert_eq!(input.len(), 40);
+ assert_eq!(input.len(), 80);
- c.bench_function("sm", |b| {
+ c.bench_function("smi", |b| {
b.iter(|| {
let mut count = 0;
- black_box(sm(input.as_slice(), &mut count))
+ black_box(smi(input.as_slice(), &mut count))
})
});
}
-fn bench_50(c: &mut Criterion) {
+fn bench_160(c: &mut Criterion) {
let mut rng = thread_rng();
let input = {
let uniform = Uniform::new(-100.0f32, 100.0f32);
- uniform.sample_iter(&mut rng).take(50).collect::<Vec<_>>()
+ uniform.sample_iter(&mut rng).take(160).collect::<Vec<_>>()
};
- assert_eq!(input.len(), 50);
+ assert_eq!(input.len(), 160);
- c.bench_function("sm", |b| {
+ c.bench_function("smi", |b| {
b.iter(|| {
let mut count = 0;
- black_box(sm(input.as_slice(), &mut count))
+ black_box(smi(input.as_slice(), &mut count))
})
});
}
-criterion_group!(benches, bench_10, bench_20, bench_30, bench_40, bench_50);
+criterion_group!(benches, bench_10, bench_20, bench_40, bench_80, bench_160);
criterion_main!(benches);