Features

Eight crates, one locality model.

numaperf is a focused set of NUMA primitives, grouped by what you’re trying to do: discover the machine, place memory, pin threads, schedule work where its data lives, and observe the result. Use the facade for everything or pull in only the crates you need.

Discover

Know the machine before you place a single byte.

numaperf-topo

Topology discovery

Query NUMA nodes, CPUs, and inter-node distances at runtime with Topology::discover(). Stop assuming a fixed layout — read the real one and branch on it.

numaperf-io

Device locality

Map NICs and NVMe devices to their NUMA nodes, then allocate device buffers on the device-local node. Skip the cross-node copy that packet- and storage-heavy paths pay by default.

Place

Decide where memory lives, and make the decision stick.

numaperf-mem

Memory placement policies

Explicit MemPolicy: Bind, Preferred, Interleave, Local. You choose the policy instead of inheriting the kernel’s first-touch heuristic.

Prefault::Touch

Prefaulting

Pair a policy with Prefault::Touch so pages are faulted in and placed at allocation time — before the hot path runs and before placement can drift.

Pin

Constrain where work runs, without leaking affinity across scopes.

numaperf-affinity

RAII thread pinning

ScopedPin is a RAII handle that pins the current thread to a node’s CPUs and restores the previous affinity on drop. No affinity leaks across worker-pool transitions or refactors.

Schedule

Run work where its data already is.

numaperf-sched

Per-node work scheduling

NumaExecutor runs per-node worker pools with node-scoped work stealing only. Schedule queries on data-local workers instead of whatever core happened to be free.

numaperf-sharded

Sharded data structures

NumaSharded<T> gives you per-node data; ShardedCounter is lock-free counting that does not bounce a cache line across the box under contention.

Observe

Measure locality in numbers you can put on a dashboard.

numaperf-perf

Locality observability

Track locality ratios, generate health reports, and identify cross-node traffic. Find the placement leak before it shows up as a wandering p99.

mode

Hard mode vs graceful

Strict enforcement when you need guarantees; graceful degradation when the hardware (or macOS) has no NUMA to enforce against. The default is your choice, not the OS’s.

See it end to end

The quickstart wires these together in five steps; the architecture page explains how the pieces compose.