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
so i found a kind of nasty bug related to the new parallel scheduler, but that led me to what should be a optimization for large projects
The issue is that the bevy_ecs Query knows more about its archetype access than the internal hecs Query. Lets say you want to query &mut T, but there are no entities with T. The bevy_ecs query knows that it doesn't need to access any archetypes this frame, so the scheduler schedules that system alongside other systems that might access &mut T archetypes. But then if you try to iterate the (empty) query in the first system, it still tries to borrow &mut T in all archetypes that have it
this is because hecs queries iterate over all archetypes and filter them as they go
awhile back i created this issue: #53 because if we have hundreds of archetypes then iteration becomes needlessly expensive. The "fix" here is to pass in a reference to the bevy_ecs Query archetype bitset, so it only accesses the archetypes it needs to this frame.
And if we're doing that to fix the borrow bug (panicing when two &mut systems both borrow T, even though only one actually needs it), we might as well use that data to optimize iteration too.
The text was updated successfully, but these errors were encountered:
so i found a kind of nasty bug related to the new parallel scheduler, but that led me to what should be a optimization for large projects
The issue is that the bevy_ecs Query knows more about its archetype access than the internal hecs Query. Lets say you want to query &mut T, but there are no entities with T. The bevy_ecs query knows that it doesn't need to access any archetypes this frame, so the scheduler schedules that system alongside other systems that might access &mut T archetypes. But then if you try to iterate the (empty) query in the first system, it still tries to borrow &mut T in all archetypes that have it
this is because hecs queries iterate over all archetypes and filter them as they go
awhile back i created this issue: #53 because if we have hundreds of archetypes then iteration becomes needlessly expensive. The "fix" here is to pass in a reference to the bevy_ecs Query archetype bitset, so it only accesses the archetypes it needs to this frame.
And if we're doing that to fix the borrow bug (panicing when two &mut systems both borrow T, even though only one actually needs it), we might as well use that data to optimize iteration too.
The text was updated successfully, but these errors were encountered: