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
My idea is that, if I need to use some complex dynamic data structure in the computation, it would be better to create one of them for each thread and then clean and reuse the same structures for each item instead of cloning the structure each time.
The text was updated successfully, but these errors were encountered:
The current _with methods don't clone for every item, only at the granularity of jobs (a split/group of items) that may be sent/stolen between threads. You can of course reset that structure for each item if you like.
We don't do this specifically per-thread, because we don't even know which thread a job is going to run on until it actually starts. We clone _with values each time we split the items, so they may be stolen to another thread. The thread pool in rayon-core doesn't actually know anything about parallel iterators, let alone these _with values.
There are some ideas for actual thread-local values in #569 though.
My idea is that, if I need to use some complex dynamic data structure in the computation, it would be better to create one of them for each thread and then clean and reuse the same structures for each item instead of cloning the structure each time.
The text was updated successfully, but these errors were encountered: