Back to Blog

par-core & par-iter: Switchable parallelization for Rust

tl;dr:

I forked rayon to allow switching parallelization library or disable parallelization. See par-iter and par-core.

I’m the creator of the SWC project. I’ve been using chili the SWC Minifier. chili is a parallelization library with a heartbeat scheduling algorithm. I found that it performs far better than rayon for my usecase. But it lacks an API like parallel iterators of rayon. Additionally, I need to use different parallelization libraries for next.js or rspack and disable parallelism for Wasm targets. So I forked rayon and named it par-iter. par-iter is based on par-core, which allows selecting rayon or chili for parallelism or even disabling parallelism using cargo features.

I prefer to get it merged back to rayon , so I filed an issue on the rayon issue tracker to ask if they are open to PR for it, but I don’t think it’s likely, considering the package name.

Any ideas, thoughts, and feedback are welcome!