C++ hash-map

Open-source C++ projects categorized as hash-map

Top 7 C++ hash-map Projects

  • sparsepp

    A fast, memory efficient hash map for C++

  • robin-map

    C++ implementation of a fast hash map and hash set using robin hood hashing

  • Project mention: Factor is faster than Zig | news.ycombinator.com | 2023-11-10

    In my example the table stores the hash codes themselves instead of the keys (because the hash function is invertible)

    Oh, I see, right. If determining the home bucket is trivial, then the back-shifting method is great. The issue is just that it’s not as much of a general-purpose solution as it may initially seem.

    “With a different algorithm (Robin Hood or bidirectional linear probing), the load factor can be kept well over 90% with good performance, as the benchmarks in the same repo demonstrate.”

    I’ve seen the 90% claim made several times in literature on Robin Hood hash tables. In my experience, the claim is a bit exaggerated, although I suppose it depends on what our idea of “good performance” is. See these benchmarks, which again go up to a maximum load factor of 0.95 (Although boost and Absl forcibly grow/rehash at 0.85-0.9):

    https://strong-starlight-4ea0ed.netlify.app/

    Tsl, Martinus, and CC are all Robin Hood tables (https://github.com/Tessil/robin-map, https://github.com/martinus/robin-hood-hashing, and https://github.com/JacksonAllan/CC, respectively). Absl and Boost are the well-known SIMD-based hash tables. Khash (https://github.com/attractivechaos/klib/blob/master/khash.h) is, I think, an ordinary open-addressing table using quadratic probing. Fastmap is a new, yet-to-be-published design that is fundamentally similar to bytell (https://www.youtube.com/watch?v=M2fKMP47slQ) but also incorporates some aspects of the aforementioned SIMD maps (it caches a 4-bit fragment of the hash code to avoid most key comparisons).

    As you can see, all the Robin Hood maps spike upwards dramatically as the load factor gets high, becoming as much as 5-6 times slower at 0.95 vs 0.5 in one of the benchmarks (uint64_t key, 256-bit struct value: Total time to erase 1000 existing elements with N elements in map). Only the SIMD maps (with Boost being the better performer) and Fastmap appear mostly immune to load factor in all benchmarks, although the SIMD maps do - I believe - use tombstones for deletion.

    I’ve only read briefly about bi-directional linear probing – never experimented with it.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • Hopscotch map

    C++ implementation of a fast hash map and hash set using hopscotch hashing

  • ordered-map

    C++ hash map and hash set which preserve the order of insertion

  • fph-table

    Flash Perfect Hash Table: an implementation of a dynamic perfect hash table, extremely fast for lookup

  • HashTableBenchmark

    A simple cross-platform speed & memory-efficiency benchmark for the most common hash-table implementations in the C++ world

  • qc-hash

    Extremely fast unordered map and set library for C++20

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020).

C++ hash-map related posts

  • Fibonacci Hashing: An Optimization the World Forgot (Better Than Integer Modulo)

    1 project | news.ycombinator.com | 30 Apr 2023
  • How to create std::map that preserves the order of insertion just using standard C++?

    1 project | /r/cpp_questions | 17 Sep 2022
  • boost::unordered map is a new king of data structures

    10 projects | /r/cpp | 30 Jun 2022
  • Updating map_benchmarks: Send your hashmaps!

    13 projects | /r/cpp | 16 Jun 2022
  • Yes, this is embarrassingly slow .so I solved your problem

    1 project | news.ycombinator.com | 26 Mar 2022
  • Unum blog: Apple to Apple Comparison: M1 Max vs Intel. How a DDR5-powered MacBook beat a DDR4-powered MacBook and approached a $50K Server in Hash-Table Benchmarks

    1 project | /r/apple | 24 Dec 2021
  • Hacker News top posts: Dec 24, 2021

    4 projects | /r/hackerdigest | 24 Dec 2021
  • A note from our sponsor - SaaSHub
    www.saashub.com | 10 May 2024
    SaaSHub helps you find the best software and product alternatives Learn more →

Index

What are some of the best open-source hash-map projects in C++? This list will help you:

Project Stars
1 sparsepp 1,230
2 robin-map 1,184
3 Hopscotch map 704
4 ordered-map 504
5 fph-table 38
6 HashTableBenchmark 10
7 qc-hash 10

Sponsored
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com