File: hash.rs

package info (click to toggle)
rust-divbuf 0.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 204 kB
  • sloc: makefile: 2
file content (20 lines) | stat: -rw-r--r-- 419 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#![feature(test)]

extern crate test;

use std::{collections::hash_map::DefaultHasher, hash::Hash};

use divbuf::*;
use test::Bencher;

#[bench]
fn bench_divbuf_hash(bench: &mut Bencher) {
    let dbs = DivBufShared::from(vec![0u8; 8]);
    let db = dbs.try_const().unwrap();
    let mut hasher = DefaultHasher::new();

    bench.bytes = db.len() as u64;
    bench.iter(move || {
        db.hash(&mut hasher);
    })
}