For example, I wrote like this:
let mut v: Vec<usize> = (0..10).into_par_iter().collect();
If I then push an extra element into v
, it will probably trigger an alloc and copy operation.
So,
- Can I somehow hint rayon about the vector size it
collects
? - What's more, can I even give rayon a vector and do the same thing?