r/datascience • • 29d ago

Tools mizu: a new tool to speed up parallel data science workflows

(I’m Hadley Wickham, Chief Scientist at Posit and I’m posting this for my colleague Charlie Gao (u/shikokuchuo) who doesn't have enough karma to post here 🤣).

Resampling (bootstrap, cross-validation, ...) is a common part of modelling that takes a long time and in principle should be trivially parallelisable. Unfortunately, in reality the speedup is usually well short of the allocated cores. The reason is how the process pool has to distribute work: each task is serialized, copied through a socket then deserialized on the other side, and each result has to come back the same way. This has two problems: when tasks are small the overhead can exceed the computation, and when the data is large every worker holding a copy exhausts memory.

Charlie has come up with a new solution using shared memory. pymizu (Python) and mizu (R) use shared memory to parallelise work. The data for each task is written once into memory that the scheduler and worker share, so the worker reads it without copying. Compared to using sockets (the current fastest approach) a round trip drops from about 100 µs to under 1 µs (measured on an Apple M4 Pro). And this makes a difference for data science workflows: four typical tidymodels workloads  chosen to stress data movement relative to compute, 12 mizu workers gave 6.7–8.1x speedups versus 1.4–6.4x for mirai, already the most performant parallel framework in R. 

In Python, pymizu is a drop-in replace for theconcurrent.futuresexecutor, and NumPy arrays and polars/pyarrow/pandas frames cross between processes without any copies. pymizu and mizu are designed to work together for cross-language workflows. Each can launch workers in either language, so a data frame in an R session can cross to a Python worker as an Arrow-backed frame, and the polars result comes back as an R data frame.

More details, benchmarks, and examples are available at: https://opensource.posit.co/blog/2026-11-05_mizu-0-1-0/ or get started with
pip install pymizu / install.packages("mizu").

348 Upvotes

50 comments sorted by

140

u/CityInternational605 29d ago

What seriously Hadley Wickham the GOAT himself?

85

u/hadley 29d ago

🐐

12

u/TrueBirch 29d ago

All hail the king! 

7

u/timClicks 29d ago

Thanks for taking the time to post this here Hadley.

2

u/mattstats 29d ago

Yeah no kidding I was scrolling by and had to scroll back up and read this haha

1

u/CarRepresentative843 25d ago

who?

Just kidding, this is very exciting!

10

u/HazardCinema 29d ago

tidyverse is the foundation of my early DS career. Just want to say thank you. I'm barely coding live anymore but I'll always appreciate the fundamentals your libraries taught me.

2

u/hadley 27d ago

You’re very welcome ☺️

1

u/hendrik0806 21d ago

Just wanted to +1. You introduced programming and ds in such a playful way. Even after years I’m still a fan of the tidyverse and its simple design principles.

20

u/lhrad 29d ago

In Hungarian "mizu?" means sth like"wazzup?", lol.

17

u/shikokuchuo 29d ago

That's nice to know! mizu??

6

u/smellyCat3226 29d ago

in japanese it means water

1

u/Comrade_SOOKIE 28d ago

It's probably this mizu: 水

4

u/shikokuchuo 28d ago

Yes, indeed it is 😄

11

u/Deto 29d ago

I'm curious if you've compared this to joblib on the python side?

46

u/shikokuchuo 29d ago

There's a basic comparison in the pymizu docs: https://shikokuchuo.net/pymizu/user-guide/benchmarks.html We didn't think to benchmark it as it wouldn't be close

8

u/Deto 29d ago

Huh,  I figured since joblib memory maps the numeric data it would be similar in terms of benefits

33

u/shikokuchuo 29d ago

A key difference is we don't go through the filesystem. Also it feels they are closer in spirit to mirai + mori on the R side (distributed computing + shared objects), not an entirely new architecture for shared memory IPC

8

u/Ginger_Rook 29d ago

Make a few more comments so that we can upvote you to give you karma 🤣

25

u/shikokuchuo 29d ago

More than happy to! 😂

5

u/Ginger_Rook 29d ago

And we are happy to help :)

18

u/shikokuchuo 29d ago

As it seems 😄

1

u/3_Cobblesworth 24d ago

Joblib is solid, but shared memory can boost heavy data tasks!

11

u/Key-Accident2075 29d ago

Very interesting. Just the other day, I was musing how R is sort of inefficient when it comes to parallelisation and then you guys drop mizu.

Congrarulation to the team. Will check it out next week!

5

u/Delicious-View-8688 29d ago

Be water my friend. Will check it out. Thanks!

2

u/_b10ck_h3ad_ 29d ago

Surely you mean, be mizu 🌊🌊🌊

5

u/burtcopaint 29d ago

Wow, nice to see you.
I still hate that Twitter to X transition. Lost so much good info...

6

u/Zeiramsy 29d ago

Off-topic but your video showing your DS workflow on house price modelling basically started my whole DS career, one of the most insightful DS videos I ever saw.

This looks really interesting.

3

u/Oh_Petya 29d ago

This is perfect timing! A project I am working on involves a specification analysis of 766 models where I evaluate each one under time series cross-validation (i.e. evaluating on a rolling origin) across 371 origins, so I'm fitting models 284186 times! I'm currently using furrr to parallelize it on my server and I can get the cross-validations done in about 12 hours.

I'll give this a try and see how much it speeds it up and improves memory usage. I have to dip into swap memory frequently with my current method.

1

u/c_r-3143523 12d ago

Run the same small, fixed set of origins in furrr and mizu and compare outputs first; then measure runtime and peak memory at your intended worker count.

1

u/Oh_Petya 12d ago

Yes, I did basically this. What I found was that runtime was slower overall (about 1.5x slower), but peak memory usage was significantly less.

2

u/horapdethap 29d ago

A while ago I tried this with dask, persisting a big dataframe scattered across cluster nodes for tasks to share (https://distributed.dask.org/en/stable/memory.html#persisting-collections) but still got out of memory errors. Excited to try this

Any plans for making massively scalable permutation tests as a function you can just call?

8

u/shikokuchuo 29d ago

It doesn't seem within scope for *this* project, but we're glad you're excited to try it out - do let us know how you get on!

1

u/markhahn 16d ago

I'm no Dask expert, but from the docs, it looks to me like its worker/memory paradigm would need some interface changes to accommodate either shared memory or RDMA (which you'd want to use on a cluster).

2

u/Ok-Introduction9593 29d ago

Cool concept. Are there any gotchas when working with custom Python objects? Or does the zero-copy magic only apply to numpy and arrow backends?

8

u/shikokuchuo 29d ago

It works with any buffer-protocol object. We're also not done yet with supported formats, so do check in as we continue to develop this!

1

u/pneumatics 26d ago

Hi Hadley, wasn’t this the original motivation for you and Wes McKinney developing arrow? Zero copy in-memory interop between R and Python? How is mizu different?

1

u/markhahn 16d ago

does Arrow deal with concurrency? I see a "flight" mechanism for IPC (RPC), but not shared memory or RDMA.

1

u/pneumatics 16d ago

Wasn’t this the original motivation for arrow C

1

u/markhahn 16d ago

No, I don't think so. Looking at their current description of their purpose, it was mainly storage-memory interop while avoiding the overhead of conversion-heavy de-/serialization. There's definitely no implication of providing the synchronization necessary to support realtime-concurrent RW data.

2

u/pneumatics 15d ago

Arrow did ship with the plasma project from Ray which served this function, cross process low overhead interoperability, but was removed around arrow 12. Seems libmizu picks up the original mantle

1

u/simonpcouch 23d ago

Super excited about this one! More performant than mirai is wild, especially by this margin.

1

u/ApplicationFar2400 19d ago

This looks promising! The focus on shared memory for parallelization really addresses the traditional bottlenecks we face with resampling tasks. Seeing 6.7–8.1x speedups in typical tidymodels workloads compared to existing frameworks is impressive. I’m especially intrigued by how pymizu integrates so seamlessly with Python tools, allowing for efficient data frame exchanges without the overhead of copying. It could really streamline workflows across languages.