Skip to content

v0.12.0 — Performance Overhaul + HAM Pre-Filter

Choose a tag to compare

@guan-tends guan-tends released this 13 Aug 23:53
· 124 commits to master since this release

17.5× Throughput Improvement

BEAM v0.12.0 delivers a 17.5× improvement in local put throughput (3,050 → 53,300 puts/sec on a clean machine) with zero functional regressions.

Highlights

  • HAM (Hypothetical Amnesia Machine) pre-filter — Router-maintained timestamp index that checks incoming Put timestamps before any storage/relay work. Mirrors Gun.js ham() function. "Avoid work" not "do work faster."
  • Arc actor system — Zero-copy message fanout via Arc::clone instead of deep clone per subscriber
  • Lazy broadcast channels — Channels created on first subscriber, not on node creation. Eliminates 37% allocation hotspot (9.7× alone)
  • Arc consolidation — Node clone cost reduced from ~12 atomics + 3 heap allocs to a single atomic increment
  • &Put signatures — Eliminates unconditional deep clone of BTreeMap on every message (the 17.5× win)
  • Zero-copy WebSocket serialization — to_writer + std::mem::take replaces buffer cloning

Performance

Metric v0.11.0 v0.12.0 Improvement
Local put (clean machine) 3,050/sec ~53,300/sec 17.5×
Relay 1×10k 3,041/sec 6,952/sec 2.3×
Relay 1×50k 2,410/sec 16,005/sec 6.6×
Relay 10×5k 2,014/sec 11,604/sec 5.8×

Flame graph confirms flat profile — no dominant hotspot above 4.74%.

Test Suite

  • 360 native tests pass (0 fail, 24 ignored)
  • 7 WASM tests pass (0 fail, 4 ignored)
  • 19 doctests pass (0 fail, 12 ignored)
  • Zero clippy warnings, cargo fmt clean

Full changelog: CHANGELOG.md