for size in &sizes {
group.throughput(Throughput::Bytes(*size as u64));
group.bench_with_input(BenchmarkId::from_parameter(size), size, |b, &size| {
b.iter_with_setup(
|| seahash::SeaHasher::default(),
|mut h: seahash::SeaHasher| { // use chunks of 32 bytes to simulate some looping on a single hasher value for _ in0..size / 32 {
h.write(&buf[..32]);
} // this will mostly be an empty slice, but that is a possible Hasher api usage
h.write(&buf[..(size % 32)]);
black_box(h.finish())
},
)
});
}
group.finish();
// gigabyte group times are comparable with earlier benchmark values based on // d52d115a223a0e81d1600bd8a5e73cb4b24a38c0 letmut group = c.benchmark_group("gigabyte");
group.throughput(Throughput::Bytes((1024 * 1024 * 1024) as u64));
group.bench_function(BenchmarkId::from_parameter("buffer"), |b| {
b.iter(|| { letmut buf = [15; 4096]; letmut total = 0; for _ in0..250_000 {
total ^= seahash::hash(&buf);
buf[0] = buf[0].wrapping_add(1);
}
black_box(total)
})
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.