GitXplorerGitXplorer
r

hashbrown

public
2529 stars
294 forks
89 issues

Commits

List of commits on branch master.
Verified
d76a3dee14748fe65c234e28d0b7fa9d8b73414c

Merge pull request #605 from brunogouveia/hash-map-set-into-iter

AAmanieu committed 10 days ago
Unverified
d615baf472a9e2fac1dab54bbfcfa816e8744a17

Added Allocator template argument for rustc_iter

bbrunogouveia committed 14 days ago
Verified
16044fe2f8784f665a563849cc63867cbafb80c6

Merge pull request #604 from mumbleskates/msrv-badge

AAmanieu committed a month ago
Verified
e41d1cbf7958a51419e9e36f7320bf3f4c5d79c1

Merge pull request #592 from heiher/loong-lsx

AAmanieu committed a month ago
Verified
33b1ec8502fd36632899d70f99173baa27789e5b

reflect updated msrv in the readme badge

mmumbleskates committed a month ago
Unverified
a35580fd80742c0a53bfc34398a2ba4e10ebf5cd

Add 128-bit SIMD implementation for LoongArch

hheiher committed 2 months ago

README

The README file for this repository.

hashbrown

Build Status Crates.io Documentation Rust

This crate is a Rust port of Google's high-performance SwissTable hash map, adapted to make it a drop-in replacement for Rust's standard HashMap and HashSet types.

The original C++ version of SwissTable can be found here, and this CppCon talk gives an overview of how the algorithm works.

Since Rust 1.36, this is now the HashMap implementation for the Rust standard library. However you may still want to use this crate instead since it works in environments without std, such as embedded systems and kernels.

Features

  • Drop-in replacement for the standard library HashMap and HashSet types.
  • Uses foldhash as the default hasher, which is much faster than SipHash. However, foldhash does not provide the same level of HashDoS resistance as SipHash, so if that is important to you, you might want to consider using a different hasher.
  • Around 2x faster than the previous standard library HashMap.
  • Lower memory usage: only 1 byte of overhead per entry instead of 8.
  • Compatible with #[no_std] (but requires a global allocator with the alloc crate).
  • Empty hash maps do not allocate any memory.
  • SIMD lookups to scan multiple hash entries in parallel.

Usage

Add this to your Cargo.toml:

[dependencies]
hashbrown = "0.15"

Then:

use hashbrown::HashMap;

let mut map = HashMap::new();
map.insert(1, "one");

Flags

This crate has the following Cargo features:

  • nightly: Enables nightly-only features including: #[may_dangle].
  • serde: Enables serde serialization support.
  • rayon: Enables rayon parallel iterator support.
  • equivalent: Allows comparisons to be customized with the Equivalent trait. (enabled by default)
  • raw-entry: Enables access to the deprecated RawEntry API.
  • inline-more: Adds inline hints to most functions, improving run-time performance at the cost of compilation time. (enabled by default)
  • default-hasher: Compiles with foldhash as default hasher. (enabled by default)
  • allocator-api2: Enables support for allocators that support allocator-api2. (enabled by default)

License

Licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.