Mizu – zero-copy parallel R and Python over shared memory github.com · 16 points...
HN Best 200 @best
Mizu – zero-copy parallel R and Python over shared memory github.com · 16 points · 1 comments · HN thread
TL;DR Mizu is a pair of packages, pymizu for Python and mizu for R, built on a shared C core (libmizu) that runs parallel tasks and maps over POSIX or Win32 shared memory. The author reports task round trips under 1 µs, versus about 100 µs over sockets, and zero-copy sharing of numpy arrays and Arrow tables between Python and R workers. The project is marked experimental.
- pymizu round trips are reported at about 0.7 µs, against 94.2 µs for ProcessPoolExecutor and 9.5 µs for ThreadPoolExecutor, measured on an Apple M4 Pro.
- Channels and task pools use lock-free single-producer single-consumer rings over POSIX shared memory (Linux, macOS) or Win32 file mappings (Windows).
- PoolExecutor is a drop-in concurrent.futures.Executor, and submit returns real Futures that work with wait, as_completed and asyncio.wrap_future.
- Numpy arrays, Arrow tables, polars, pandas and duckdb objects are shared as zero-copy views; pymizu.Frame and R data frames cross the boundary.
- Parallel maps support reproducible random numbers via seed=, and a mapped function can run a nested map on its own pool without deadlock.
- Requires Python 3.10+ on a 64-bit platform; the API is experimental and the tool works only on a single machine.
Discussion The thread is a single comment from the author, who introduces mizu (R) and pymizu (Python) and answers the obvious questions about the benchmark setup and scope. There is no independent discussion or replies yet, so the mood is informational, with the author inviting usability feedback and use cases.
- Shared-memory IPC gives much lower overhead than socket-based process pools (a few): The only commenter, the author, argues that avoiding a central dispatcher and system calls on the hot path cuts task round trips from about 100 µs to under 1 µs. The figures are self-reported on one laptop, with benchmark scripts offered for others to run.
- Limited to a single machine by design (a few): The author acknowledges that shared memory confines the approach to one host, and that the API is still experimental and open to feedback.
Links from the comments