Sha256: cb84275f22d5f95a5ac995ac6b2df74ffcf342765b401d27c95f2955c7b7cb9f

Contents?: true

Size: 734 Bytes

Versions: 69

Compression:

Stored size: 734 Bytes

Contents

//! Compare `insert` and `insert_unique_unchecked` operations performance.

#![feature(test)]

extern crate test;

use hashbrown::HashMap;
use test::Bencher;

#[bench]
fn insert(b: &mut Bencher) {
    let keys: Vec<String> = (0..1000).map(|i| format!("xxxx{}yyyy", i)).collect();
    b.iter(|| {
        let mut m = HashMap::with_capacity(1000);
        for k in &keys {
            m.insert(k, k);
        }
        m
    });
}

#[bench]
fn insert_unique_unchecked(b: &mut Bencher) {
    let keys: Vec<String> = (0..1000).map(|i| format!("xxxx{}yyyy", i)).collect();
    b.iter(|| {
        let mut m = HashMap::with_capacity(1000);
        for k in &keys {
            m.insert_unique_unchecked(k, k);
        }
        m
    });
}

Version data entries

69 entries across 38 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/hashbrown-0.14.5/benches/insert_unique_unchecked.rs
wasmtime-28.0.0 ./ext/cargo-vendor/hashbrown-0.14.5/benches/insert_unique_unchecked.rs
wasmtime-27.0.0 ./ext/cargo-vendor/hashbrown-0.14.5/benches/insert_unique_unchecked.rs
wasmtime-26.0.0 ./ext/cargo-vendor/hashbrown-0.14.5/benches/insert_unique_unchecked.rs
wasmtime-25.0.2 ./ext/cargo-vendor/hashbrown-0.14.5/benches/insert_unique_unchecked.rs
wasmtime-25.0.1 ./ext/cargo-vendor/hashbrown-0.14.5/benches/insert_unique_unchecked.rs
wasmtime-25.0.0 ./ext/cargo-vendor/hashbrown-0.14.5/benches/insert_unique_unchecked.rs
wasmtime-24.0.0 ./ext/cargo-vendor/hashbrown-0.13.2/benches/insert_unique_unchecked.rs
wasmtime-24.0.0 ./ext/cargo-vendor/hashbrown-0.14.5/benches/insert_unique_unchecked.rs
wasmtime-23.0.2 ./ext/cargo-vendor/hashbrown-0.13.2/benches/insert_unique_unchecked.rs
wasmtime-23.0.2 ./ext/cargo-vendor/hashbrown-0.14.3/benches/insert_unique_unchecked.rs
wasmtime-22.0.0 ./ext/cargo-vendor/hashbrown-0.14.3/benches/insert_unique_unchecked.rs
wasmtime-22.0.0 ./ext/cargo-vendor/hashbrown-0.13.2/benches/insert_unique_unchecked.rs
wasmtime-21.0.1 ./ext/cargo-vendor/hashbrown-0.14.3/benches/insert_unique_unchecked.rs
wasmtime-21.0.1 ./ext/cargo-vendor/hashbrown-0.13.2/benches/insert_unique_unchecked.rs
wasmtime-20.0.2 ./ext/cargo-vendor/hashbrown-0.13.2/benches/insert_unique_unchecked.rs
wasmtime-20.0.2 ./ext/cargo-vendor/hashbrown-0.14.3/benches/insert_unique_unchecked.rs
wasmtime-20.0.0 ./ext/cargo-vendor/hashbrown-0.14.3/benches/insert_unique_unchecked.rs
wasmtime-20.0.0 ./ext/cargo-vendor/hashbrown-0.13.2/benches/insert_unique_unchecked.rs
wasmtime-18.0.3 ./ext/cargo-vendor/hashbrown-0.14.3/benches/insert_unique_unchecked.rs