You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For types that only implement ParallelIterator but none of the other traits, is there a good recipe to chunk the items before starting parallelism?
I have a function that generates an opaque -> impl Iterator<Item = T> so I am only able to use .par_bridge(). It is a case of cheap operations on a high number of items, so ideally a few thousand iterator items get collected to a Vec and then those chunks get run in parallel.
It is easy enough to do this manually but it seems like there may be a cleaner builtin way that I am not seeing. As an added benefit, if Rayon handles the chunking then it can clear reuse the vectors.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
For types that only implement
ParallelIterator
but none of the other traits, is there a good recipe to chunk the items before starting parallelism?I have a function that generates an opaque
-> impl Iterator<Item = T>
so I am only able to use.par_bridge()
. It is a case of cheap operations on a high number of items, so ideally a few thousand iterator items get collected to aVec
and then those chunks get run in parallel.It is easy enough to do this manually but it seems like there may be a cleaner builtin way that I am not seeing. As an added benefit, if Rayon handles the chunking then it can clear reuse the vectors.
Beta Was this translation helpful? Give feedback.
All reactions