How to make rayon's `iter.par_bridge()` as fast as `vec.into_par_iter()`?

⚓ Rust    📅 2025-07-01    👤 surdeus    👁️ 4      

surdeus

Warning

This post was published 37 days ago. The information described in this article may have changed.

Recently, I refactored my codebase to solve a memory issue. I saw that all the Vecs are taking up too much memory, so I decided to switch to lazy iterators instead. However, I encountered another surprise: The performance of my program was worse than the Vec version.

I then ran cargo flamegraph. I saw that in the iterator bridge version, there are multiple wide white holes (probably because only 1 thread is running there). The Vec version still has holes but they are narrower.

Is there a way to solve memory issue without compromising speed?

1 post - 1 participant

Read full topic

🏷️ rust_feed