All Projects → martinus → Robin Hood Hashing

martinus / Robin Hood Hashing

Licence: mit
Fast & memory efficient hashtable based on robin hood hashing for C++11/14/17/20

Programming Languages

cpp
1120 projects
cpp11
221 projects
cpp14
131 projects

Projects that are alternatives of or similar to Robin Hood Hashing

Seqbox
A single file container/archive that can be reconstructed even after total loss of file system structures
Stars: ✭ 480 (-27.05%)
Mutual labels:  hash, container
Gsl Lite
gsl-lite – A single-file header-only version of ISO C++ Guidelines Support Library (GSL) for C++98, C++11, and later
Stars: ✭ 617 (-6.23%)
Mutual labels:  no-dependencies
Atomic
A tiny, Promise-based vanilla JS Ajax/HTTP plugin with great browser support.
Stars: ✭ 526 (-20.06%)
Mutual labels:  no-dependencies
Docker Php Nginx
Docker image with Nginx 1.18 & PHP-FPM 7.4 on Alpine Linux
Stars: ✭ 581 (-11.7%)
Mutual labels:  container
Ethereumjs Util
Project is in active development and has been moved to the EthereumJS monorepo.
Stars: ✭ 534 (-18.84%)
Mutual labels:  hash
Openhashtab
📝 File hashing and checking shell extension
Stars: ✭ 599 (-8.97%)
Mutual labels:  hash
John
John the Ripper jumbo - advanced offline password cracker, which supports hundreds of hash and cipher types, and runs on many operating systems, CPUs, GPUs, and even some FPGAs
Stars: ✭ 5,656 (+759.57%)
Mutual labels:  hash
Vuebar
(🗃️ Archived) Vue 2 directive for custom scrollbar that uses native scroll behavior. Lightweight, performant, customizable and without dependencies. Used successfully in production on https://ggather.com
Stars: ✭ 650 (-1.22%)
Mutual labels:  no-dependencies
Rmodal.js
A simple 1.2 KB modal dialog with no dependencies
Stars: ✭ 613 (-6.84%)
Mutual labels:  no-dependencies
Entt
Gaming meets modern C++ - a fast and reliable entity component system (ECS) and much more
Stars: ✭ 6,017 (+814.44%)
Mutual labels:  no-dependencies
Xxhash
Extremely fast non-cryptographic hash algorithm
Stars: ✭ 5,783 (+778.88%)
Mutual labels:  hash
Specs
Content-addressed, authenticated, immutable data structures
Stars: ✭ 539 (-18.09%)
Mutual labels:  hash
Smooth Scroll
A lightweight script to animate scrolling to anchor links.
Stars: ✭ 5,350 (+713.07%)
Mutual labels:  no-dependencies
Nexclipper
Metrics Pipeline for interoperability and Enterprise Prometheus
Stars: ✭ 533 (-19%)
Mutual labels:  container
Jquery.localscroll
Animated anchor navigation made easy with jQuery
Stars: ✭ 624 (-5.17%)
Mutual labels:  hash
Liman
Self-hosted web application for monitoring docker.
Stars: ✭ 518 (-21.28%)
Mutual labels:  container
Docker Atlassian Jira
Atlassian JIRA Core wrapped in a Docker image
Stars: ✭ 553 (-15.96%)
Mutual labels:  container
Runtime
OCI (Open Containers Initiative) compatible runtime using Virtual Machines
Stars: ✭ 588 (-10.64%)
Mutual labels:  container
Units
a compile-time, header-only, dimensional analysis and unit conversion library built on c++14 with no dependencies.
Stars: ✭ 653 (-0.76%)
Mutual labels:  no-dependencies
Gumshoe
A simple vanilla JS scrollspy script.
Stars: ✭ 640 (-2.74%)
Mutual labels:  no-dependencies

➵ robin_hood unordered map & set Release GitHub license

Travis CI Build Status Appveyor Build Status Codacy Badge Total alerts Language grade: C/C++ Coverage Status

robin_hood::unordered_map and robin_hood::unordered_set is a platform independent replacement for std::unordered_map / std::unordered_set which is both faster and more memory efficient for real-world use cases.

Installation & Usage

Direct Inclusion

  1. Add robin_hood.h to your C++ project.
  2. Use robin_hood::unordered_map instead of std::unordered_map
  3. Use robin_hood::unordered_set instead of std::unordered_set

Conan, the C/C++ Package Manager

  1. Setup your CMakeLists.txt (see Conan documentation on how to use MSBuild, Meson and others) like this:
    project(myproject CXX)
    
    add_executable(${PROJECT_NAME} main.cpp)
    
    include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) # Include Conan-generated file
    conan_basic_setup(TARGETS) # Introduce Conan-generated targets
    
    target_link_libraries(${PROJECT_NAME} CONAN_PKG::robin-hood-hashing)
    
  2. Create conanfile.txt in your source dir (don't forget to update the version)
    [requires]
    robin-hood-hashing/3.10.0
    
    [generators]
    cmake
    
  3. Install and run Conan, then build your project as always:
    pip install conan
    mkdir build
    cd build
    conan install ../ --build=missing
    cmake ../
    cmake --build .
    
    The robin-hood-hashing package in Conan is kept up to date by Conan contributors. If the version is out of date, please create an issue or pull request on the conan-center-index repository.

Benchmarks

Please see extensive benchmarks at Hashmaps Benchmarks. In short: robin_hood is always among the fastest maps and uses far less memory than std::unordered_map.

Design Choices

  • Two memory layouts. Data is either stored in a flat array, or with node indirection. Access for unordered_flat_map is extremely fast due to no indirection, but references to elements are not stable. It also causes allocation spikes when the map resizes, and will need plenty of memory for large objects. Node based map has stable references & pointers (NOT iterators! Similar to std::unordered_map) and uses const Key in the pair. It is a bit slower due to indirection. The choice is yours; you can either use robin_hood::unordered_flat_map or robin_hood::unordered_node_map directly. If you use robin_hood::unordered_map It tries to choose the layout that seems appropriate for your data.

  • Custom allocator. Node based representation has a custom bulk allocator that tries to make few memory allocations. All allocated memory is reused, so there won't be any allocation spikes. It's very fast as well.

  • Optimized hash. robin_hood::hash has custom implementations for integer types and for std::string that are very fast and falls back to std::hash for everything else.

  • Depends on good Hashing. For a really bad hash the performance will not only degrade like in std::unordered_map, the map will simply fail with an std::overflow_error. In practice, when using the standard robin_hood::hash, I have never seen this happening.

License

Licensed under the MIT License. See the LICENSE file for details.

by martinus

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].