Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Performance & Benchmarks

Results from v0.6.2 · Criterion · Dell Latitude 7490 · i7-8650U · Linux

Single-Thread (100K ops)

BenchmarkPulseMaplruquick_cachemoka
INSERT6.1 ms19.1 ms5.6 ms161 ms
LOOKUP4.2 ms5.4 ms2.8 ms40 ms
MIXED8.5 ms23.7 ms8.4 ms187 ms
EVICTION (50K)1.9 ms 🥇2.3 ms3.3 ms55.5 ms

Where PulseMap Wins

Eviction-heavy workloads — PulseMap’s core strength. Eviction metadata lives in the same 64-byte cache line as data slots, so eviction decisions cost zero additional cache misses.

  • 1.7x faster than quick_cache on eviction
  • 29x faster than moka on eviction
  • 3.1x faster than lru on insert

Where PulseMap Loses

Pure lookup — PulseMap stores values as serialized bytes (enabling no_std + FFI bindings), which adds deserialization cost on read. Note: AtomicU64 lock-free reads and AccessBuffer narrowed the gap on concurrent lookups in v0.6.2.

  • quick_cache lookup: 1.5x faster than PulseMap
  • lru lookup: PulseMap is now faster (4.2 ms vs 5.4 ms)

Multi-Thread — 4 Threads, 100K ops

BenchmarkShardedPulseMapConcurrentPulseMapmoka
4T INSERT8.8 ms 🥇20.2 ms104 ms
4T LOOKUP7.0 ms 🥇35.0 ms21.1 ms
4T MIXED12.4 ms 🥇46.6 ms197 ms

ShardedPulseMap Advantage

ShardedPulseMap uses 16 independent shards with separate locks. This eliminates the global RwLock bottleneck in ConcurrentPulseMap.

  • 2.3–3.9x faster than ConcurrentPulseMap
  • 6.5–12x faster than moka on concurrent workloads

vs std::HashMap (reference only)

HashMap has no eviction — it’s a different category entirely:

Benchmark (100K ops)PulseMapstd::HashMapNote
INSERT6.1 ms2.5 msstd has no eviction
LOOKUP4.2 ms2.9 msstd uses SIMD + native types
EVICTION1.9 msN/AHashMap can’t evict

Memory Efficiency

Map SizePulseMapHashMapSavings
1K entries16 KB48 KB67%
10K entries160 KB480 KB67%
100K entries1.6 MB4.8 MB67%
1M entries16 MB48 MB67%

Running Benchmarks

# All benchmarks
cargo bench

# Specific category
cargo bench -- insert
cargo bench -- "4t"        # 4-thread benchmarks
cargo bench -- moka        # moka comparison
cargo bench -- sharded     # ShardedPulseMap only
cargo bench -- eviction

# With SIMD (x86_64 only)
cargo bench --features simd

Cache Line Efficiency

L1 cache hit rate during lookup:

PulseMap:   ~98% (1 cache line per lookup)
HashMap:    ~60% (2-3 cache lines, pointer chasing)
BTreeMap:   ~40% (tree traversal, multiple lines)

Profiling Tips

# CPU cache analysis with perf
perf stat -e cache-misses,cache-references cargo bench

# Flamegraph
cargo install flamegraph
cargo flamegraph --bench benchmark

# Valgrind memory analysis
valgrind --tool=cachegrind target/release/examples/basic

Bottlenecks & Limits

ScenarioBottleneckMitigation
Many threads, same keyBucket spinlock contentionUse ShardedPulseMap
Resize during loadStop-the-world pauseUse ShardedPulseMap::resize_all()
Large keys (>6B)Slab allocationUse short keys when possible
>4 entries/bucketEviction overheadIncrease bucket count
Pure read workloadsSerialization costAccept trade-off for no_std/FFI