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
Note that skip is not as efficient as it could be (#352), and your example also has a problem with panic safety. If any of those drops panic, then the vector's length will not be adjusted, and the vector's own drop will try to re-drop some items!
You can see how rayon::vec::IntoIter deals with this here.
Parallel truncate seems kind of niche to me -- we should think if there may be a more general approach. A parallel drain would let you write something like vec.par_drain(len..), but we need stable RangeArgument to allow different range types. (Or we could create our own equivalent to RangeArgument.)
I have some code that truncates a large Vec and I found that the
drop
s were very costly. It would be nice to see atruncate_par
in Rayon.I use the following
unsafe
code to drop the tail of the vec in parallel:The text was updated successfully, but these errors were encountered: