Space-efficient approximate mappings using perfect hash functions
Welcome to the maph (Memory-Mapped Approximate Perfect Hash) documentation!
maph is a high-performance key-value database that provides:
Metric | Value | Notes |
---|---|---|
GET Latency | <100ns | O(1) with perfect hash |
SET Latency | <150ns | Lock-free atomic updates |
Throughput | 10M ops/sec | Single thread |
Batch Throughput | 50M ops/sec | SIMD optimized |
Memory Overhead | ~512B/entry | Fixed slot size |
maph is ideal for:
#include <maph.hpp>
// Create a store with 1M slots
auto store = maph::Maph::create("mystore.maph", 1000000);
// Store JSON data
store->set(R"({"user": "alice"})", R"({"score": 95, "level": 10})");
// O(1) retrieval
auto data = store->get(R"({"user": "alice"})");
System | maph | Redis | RocksDB | Memcached |
---|---|---|---|---|
Lookup | O(1) guaranteed | O(1) average | O(log n) | O(1) average |
Persistence | mmap | AOF/RDB | SST | None |
Memory | Optimal | 10x overhead | Compressed | In-memory |
Concurrent | Lock-free | Single-thread | Multi-thread | Multi-thread |
JSON | Native | String-based | Binary | String-based |
git clone https://github.com/yourusername/rd_ph_filter.git
cd rd_ph_filter
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
sudo make install
// C++ API
auto store = maph::Maph::create("data.maph", 100000);
store->set("key", "value");
auto val = store->get("key");
// CLI Tool
maph_cli create mystore --slots 100000
maph_cli set mystore "key" "value"
maph_cli get mystore "key"
// REST API
curl -X POST http://localhost:8080/stores \
-d '{"name": "mystore", "slots": 100000}'
curl -X PUT http://localhost:8080/stores/mystore/keys/"key" \
-d '"value"'
Benchmarks performed on:
We welcome contributions! See CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.