No timers on the data path
I/O threads busy-poll for 50 µs after the last event, then sleep in the kernel at raised priority. Zero-copy receive, several small messages per system call.
Local IPC for C++11 and newer, C, Rust, Python and Node.js
DataPath moves whole messages between processes on the same machine, from a few bytes to many megabytes. It is built for the one round trip in a thousand that other libraries leave to chance: measured at p99.9, at the worst CPU placement, with every core busy.
$ pip install com.xaymar.datapath # or npm, cargo, CMake
p99.9 over shared memory, client and server on different CCDs
p99.9 at 64 B, where socket-based stacks wait milliseconds for a timeslice
p99.9 at 64 B on the same Linux machine
Round-trip p99.9 from 16 B to 1 MiB, idle and under full CPU load. Lower is better; the scale is logarithmic. Hover a mark for its value.
Full round trip between two processes, p99.9 in µs, worst-case placement (client and server on different physical cores and, where the machine has them, different CCDs), median of 5 runs. Stress is one busy thread per logical CPU in a third process (at nice 12 on Linux); DataPath over shared memory and cpp-ipc under stress are the median of three invocations, other stress cells one. cpp-ipc and Boost.Interprocess are as shipped, measured 2026-11-25; "did not finish" means not even 16 B completed in 30 minutes.
Linux, AMD EPYC 7313P (8 cores, two CCDs), --pin 1,5:
| 64 B idle | 4 KiB idle | 64 KiB idle | 1 MiB idle | 64 B stress | 4 KiB stress | |
|---|---|---|---|---|---|---|
| DataPath, shared memory | 1.4 | 3.4 | 22 | 321 | 10 | 23 |
| cpp-ipc (shared memory) | 4.7 | 8.2 | 29 | 341 | 5,758 | 8,015 |
Boost.Interprocess message_queue |
32 | 41 | 128 | 1,155 | 464 | 313 |
| DataPath, Unix socket | 13 | 19 | 60 | 479 | 249 | 5,507 |
| libuv + DataPath's spin/priority | 14 | 20 | 56 | 541 | 3,494 | 4,924 |
| libuv as shipped | 23 | 28 | 64 | 557 | 4,070 | 4,076 |
| Chromium Mojo, bindings (main thread) | 62 | 73 | 439 | 8,704 | 7,852 | 7,997 |
Windows, AMD Ryzen 9 7940HS (8 cores, one CCD), --pin 8,12:
| 64 B idle | 4 KiB idle | 64 KiB idle | 1 MiB idle | 64 B stress | 4 KiB stress | |
|---|---|---|---|---|---|---|
| DataPath, shared memory | 2.2 | 4.1 | 19 | 130 | 5.8 | 26 |
| cpp-ipc (shared memory) | 18 | 31 | 153 | 569 | did not finish | did not finish |
Boost.Interprocess message_queue |
1.1 | 4.1 | 55 | 6,310 | did not finish | did not finish |
| DataPath, named pipe | 6.9 | 17 | 50 | 754 | 40 | 113 |
| libuv + DataPath's spin/priority | 15 | 22 | 74 | 9,659 | 104 | 187 |
| libuv as shipped | 31 | 35 | 66 | 1,075 | 265 | 401 |
Against libuv, DataPath's socket and pipe paths win through scheduling policy (busy-poll and priority), and shared memory is a further 3–10× for small messages. The two shared-memory libraries fall apart under load: cpp-ipc is about 3× DataPath idle for small messages on Linux but 4–8 ms at p99.9 with every core busy, and Boost.Interprocess is 15–20× DataPath on Linux. On Windows Boost's default spin-lock emulation is the fastest idle option for small messages, and neither library finished a 16 B run under full load in 30 minutes. Against Chromium's Mojo (Linux) it is 20–50× lower idle and 400–800× lower under full load for small messages. Full tables (p50, p99, p99.9), the methodology and the reasons are in docs/comparisons.
No dependencies beyond the C++ standard library and the operating system. One API on every platform.
I/O threads busy-poll for 50 µs after the last event, then sleep in the kernel at raised priority. Zero-copy receive, several small messages per system call.
On Windows and Linux messages move through two rings mapped only by the two processes; the pipe or socket carries just the handshake. Handlers get a private copy a hostile peer can't change.
Each send() arrives as one on_message call. Messages from different threads never interleave. One server, any number of clients.
send() never blocks and never grows without limit: it returns TooLarge or WouldBlock, and a message is queued whole or not at all.
User, group or world access control, a version handshake and peer validation before on_accept. Destroying a handle waits for running handlers.
Named pipes with I/O completion ports on Windows, Unix domain sockets with epoll on Linux and kqueue on macOS. A peer without shared memory still connects.
Host a server, accept clients, reply from the handler. send() is thread-safe and safe to call from handlers.
#include <datapath/datapath.hpp>
// Server
std::shared_ptr<datapath::server> server;
datapath::host(server, "my-service"); // a named pipe or abstract socket
server->on_accept([&](std::shared_ptr<datapath::socket> client) {
datapath::socket* raw = client.get(); // don't capture the shared_ptr in its own handler
client->on_message([raw](const uint8_t* data, size_t size) {
raw->send(data, size); // echo
});
clients.push_back(client); // keep it, or the connection closes
return true; // false rejects the client
});
// Client
std::shared_ptr<datapath::socket> sock;
if (datapath::connect(sock, "my-service") == datapath::error::Success) {
sock->on_message([](const uint8_t* data, size_t size) { /* data valid during the call */ });
sock->send("hello", 5);
}
| Platform | Transport | Status |
|---|---|---|
| Windows 10 / 11 | Named pipes, IOCP; shared memory | Supported |
| Linux | Unix domain sockets, epoll; shared memory | Supported |
| macOS | Unix domain sockets, kqueue | Supported |
| Android, iOS | as Linux / macOS | Planned |
The benchmark harness ships with the library. Run it at your own worst-case placement and see what your current IPC does at p99.9.