edict icon indicating copy to clipboard operation
edict copied to clipboard

Parallel queries from threads

Open akhilman opened this issue 2 years ago • 2 comments

Could you please briefly describe how the parallel queries will work?

akhilman avatar Jan 20 '22 19:01 akhilman

Atomic borrows from &World (kinda like in hecs) will validate that mutable aliases are never created by queries. Unsafe unchecked version of methods would exist for those who need them.

Stageless scheduler will run systems without conflicts as systems specify ahead of time what components they access and how. Scheduler will probably live in another crate.

zakarumych avatar Jan 20 '22 22:01 zakarumych

Here is plan to make parallel access possible:

  • [ ] Make World::epoch atomic;
  • [ ] Implement query_mut_unchecked, query_one_mut_unchecked, for_each_mut_unchecked, for_each_tracked_mut_unchecked, get_mut_unchecked unsafe methods for World;
  • [ ] Maybe add a runtime check for aliasing like hecs does by Fetch::borrow and Fetch::release.

akhilman avatar Apr 26 '22 10:04 akhilman

Threading support is implemented using runtime checks. Unsafe version could be added IF profiling would show that checks is a bottleneck

zakarumych avatar Sep 07 '22 14:09 zakarumych