| Crates.io | hft-channel |
| lib.rs | hft-channel |
| version | 0.2.1 |
| created_at | 2025-12-03 02:08:16.71552+00 |
| updated_at | 2025-12-10 09:45:23.122302+00 |
| description | SPMC broadcast channel for HFT and real-time systems |
| homepage | |
| repository | https://github.com/ikhomyakov/hft-channel.git |
| max_upload_size | |
| id | 1963204 |
| size | 95,355 |
A lightweight, ultra-low-latency single-producer / multi-consumer broadcast channel designed for use in high-frequency trading (HFT) and other real-time systems.
Provides predictable performance, minimal contention, and carefully controlled memory access patterns. Works for thread-to-thread broadcasting via local memory, or inter-process communication using shared memory.
no_std-friendly designReceivers use busy-waiting (spin loops) to wait for the producer to complete publishing the next message.
Implications:
This design is intended for HFT, trading engines, matching engines, real-time telemetry, and other performance-critical workloads.
[dependencies]
hft-channel = "0.1"
use hft-channel::spmc_broadcast::channel;
let (tx, rx) = channel::<u64>("/test", 512);
let (_, payload) = tx.reserve();
*payload = 42;
tx.commit();
let (_, payload) = rx.recv();
The channel tracks state as:
[ dirty (1 bit, MSB) | seq_no (63 bits) ]
Guarantees:
Pattern:
dirty == false, then copies or peeksRUSTFLAGS="-C target-cpu=native" cargo build --release --example bench
./target/release/examples/bench --help
./target/release/examples/bench broadcast -p 1000 -m 2
cargo test
Copyright © 2005–2025 IKH Software, Inc.
Licensed under LGPL-3.0-or-later.
See LICENSE or https://www.gnu.org/licenses/lgpl-3.0.html.
Contributions are welcome! Please open issues or pull requests on GitHub.
By submitting a contribution, you agree that it will be licensed under the project’s LGPL-3.0-or-later license.