Skip to content

Latest commit

 

History

History

README.md

emhash Examples

This directory contains example programs demonstrating how to use the emhash hash map and hash set libraries.

Files

File Description
basic_map.cpp Basic HashMap usage: insert, find, erase, iterate
basic_set.cpp Basic HashSet usage: insert, contains, erase
custom_allocator.cpp Using a custom allocator with emhash containers
custom_hash.cpp Using a custom hash function for user-defined key types
lru_cache.cpp LRU cache usage: time-based and size-based eviction

Build

# From project root
cmake -B build -DWITH_EXAMPLES=ON
cmake --build build

# Or compile manually
g++ -std=c++17 -I../../include basic_map.cpp -o basic_map

Available Containers

Header Container Description
emhash/hash_table5.hpp emhash5::HashMap<K,V> Three-way hybrid probing
emhash/hash_table6.hpp emhash6::HashMap<K,V> Linked-bucket with bitmask
emhash/hash_table7.hpp emhash7::HashMap<K,V> No-tombstone design
emhash/hash_table8.hpp emhash8::HashMap<K,V> Split-index + dense pairs, fast iteration
emhash/hash_set8.hpp emhash8::HashSet<K> HashSet (latest)
emilib/emihmap1.hpp emilib::HashMap<K,V> SIMD-accelerated, inline probe depth
emilib/emihmap2.hpp emilib2::HashMap<K,V> SIMD-accelerated, high load factor
emilib/emihmap3.hpp emilib3::HashMap<K,V> SIMD-accelerated, balanced default
emilib/emihmap4.hpp emilib4::HashMap<K,V> Experimental Swiss-table variant
emhash/lru_size.hpp emlru_size::lru_cache<K,V> LRU cache (size-based)
emhash/lru_time.hpp emlru_time::lru_cache<K,V> LRU cache (time-based)