-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Added behaviour with QueryOne get #543
Conversation
crates/bevy_ecs/src/system/query.rs
Outdated
self.world | ||
.get_ref_at_location_unchecked(location) | ||
.map_err(QueryError::ComponentError) | ||
if Q::Fetch::get( | ||
&self.world.archetypes[location.archetype as usize], | ||
location.index, | ||
) | ||
.map_or(true, |f| f.should_skip()) | ||
{ | ||
Err(QueryError::ComponentError(ComponentError::NoSuchEntity)) | ||
} else { | ||
self.world | ||
.get_ref_at_location_unchecked(location) | ||
.map_err(QueryError::ComponentError) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am clearly not confident on this part of PR and would gladly have a thorough review here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm this has significant performance implicantions because we are now doing a "full lookup" of every component storage in the query. I'm not sure thats worth the tradeoff when we can use "Query One" when this behavior is required.
I'm down to merge the "query one" part of this PR now, but this change will require some serious thought / im pretty sure its not worth it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I see and will update the PR to only include the query_one part.
Query unchanged as impacts performances. Added tests in bevy_ecs/hecs
Query unchanged as impacts performances. Added tests in bevy_ecs/hecs
Trying to fix #541