#Best way to run parallel iterator on bevy;prelude;Query

15 messages · Page 1 of 1 (latest)

toxic depot
#

Im using "for loop" to iterate through my query, should i use rayon par_iter()?

#

how to "convert" bevy query to rayon iterator (im new to Rust and Bevy)

viscid oyster
#

You're looking for par_for_each I think.

#

That's the bevy way to do that. Not as powerful as rayon, but it's integrated into the bevy task pool.

#

Mind you, it's certainly not required. You probably want to profile before switching to using parallel iterators, considering the overhead involved in task creation.

toxic depot
#

is there any overhead if i use impl fn on my structs over executing all logic and math from fn?

viscid oyster
#

I don't think it would make a difference. The overhead of par_for_each is caused by the creation of the parallel tasks, not anything you're doing.

toxic depot
#

for what order of magnitude is viable to use parallel tasks or moving logic into compute shader?

viscid oyster
toxic depot
viscid oyster
#

Someone like @lyric gazelle would probably know more I suspect.

lyric gazelle
#

Yes. Check the docs on Github on profiling using a flame graph!