Skip to content

Is there a rayon parallel implementation for creating array? #1435

Closed Answered by bluss
ajlee-kp asked this question in Q&A
Discussion options

You must be logged in to vote

Zip is for iteration and parallel iteration, and it allows creating arrays.

Maybe you could use Zip and .par_map_collect() to create the array.
It will only make sense if the element creating computation is heavy enough. Otherwise it will just be overhead and no gain from using rayon.

Zip needs some input to map, you can use indices or a no-allocation array for that?

Zip::from(ndarray::indices((1, 3, size.width as usize, size.height as usize)))
.par_map_collect(|(i, j, k)| ...)

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@bluss
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by nilgoyette
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants