-
Hello, I'm refactoring my code base to use entt and I'm looking for ideas on the best way to handle code executed by my job system. Right now, it (roughly) takes in an array of work data along with the total array size and max work data to handle per work group. The crash course suggests using "std::for_each" and "std::execution::par" for achieving parallelism but I'm wondering if there's any way to continue using my existing job system. I understand that there will likely be performance implications but I'm looking for a way to break up the list of entities in a view into n-sized groups. That may mean having access to the count and list of view entities and I pass the base index and count to the work group (similar to how I'm using it now with my array-based data). Or it may mean creating views ranging from a base index to the max work group size. Or maybe something else? My apologies if this has already been discussed; I tried searching to no avail but I'd also appreciate the correct terms that I should be looking for. I'm an old fart C programmer so maybe there's an standard lib solution that I can explore. The closest thing I found that works(?) is using the view's handle() function but it seems a bit messier than may be intended:
Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
afaik, the direct access only works for single-component-views or groups, since they are effectively iterating that storage directly. |
Beta Was this translation helpful? Give feedback.
-
If you want inner parallelism with your job system (opposed to outer parallelism, that is, running different systems that use different resources aka component types in parallel), I think the easiest approach to start with is something along this line:
This should get the job done quickly. Then you can measure, spot the bottlenecks if any and optimize further if necessary (this is unlikely to happen but it's hard to say without looking at the original codebase). |
Beta Was this translation helpful? Give feedback.
If you want inner parallelism with your job system (opposed to outer parallelism, that is, running different systems that use different resources aka component types in parallel), I think the easiest approach to start with is something along this line: