Skip to content
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

Borrow Access in FilteredEntity(Ref|Mut) and Entity(Ref|Mut)Except #5

Open
wants to merge 2 commits into
base: state-in-queryitem-base
Choose a base branch
from

Conversation

chescock
Copy link
Owner

Objective

Improve the performance of FilteredEntity(Ref|Mut) and Entity(Ref|Mut)Except.

FilteredEntityRef needs an Access<ComponentId> to determine what components it can access. There is one stored in the query state, but query items cannot borrow from the state, so it has to clone() the access for each row. Cloning the access involves memory allocations and can be expensive.

Solution

Let query items borrow from their query state.

Have FilteredEntity(Ref|Mut) borrow the access from the query state to avoid cloning for each row.

Have Entity(Ref|Mut)Except look up the component ids on initialization and store them in an Access that can be borrowed by each row.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant