Commit 0fcfbe28 authored by Joonas Koivunen's avatar Joonas Koivunen
Browse files

refactor: simplify gigabyte to 4k

parent 69c55c32
......@@ -3,20 +3,17 @@ extern crate core;
extern crate criterion;
use core::hash::Hasher;
use criterion::{criterion_group, criterion_main, Criterion};
use criterion::{black_box, criterion_group, criterion_main, Criterion};
fn gigabyte(c: &mut Criterion) {
c.bench_function("gigabyte", |b| b.iter(|| {
let mut x = 0;
let mut buf = [15; 4096];
for _ in 0..250000 {
x ^= seahash::hash(&buf);
buf[0] += buf[0].wrapping_add(1);
}
x
}));
c.bench_function("buffer", |b| {
b.iter({
let buf = [15; 4096];
move || {
black_box(seahash::hash(&buf));
}
})
});
c.bench_function("gigabyte_stream", |b| b.iter(|| {
let mut buf = [15;4096];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment