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

Optimize entity.add(). #6

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

player-03
Copy link

Supersedes #1.

Instead of attempting to add an entity to ALL views, it's best to check only views of the newly-added component. So if you add a String component, the function will call ViewsOfComponentString.inst().addIfMatched() instead of iterating through Workflow.views.

Interestingly, entity.remove() was already optimized this way, so I assume this was an oversight.

player-03 and others added 4 commits June 1, 2022 01:19
You don't use `return` during array comprehension; that will make the enclosing function return. Other than that, I just think it's easier to read without chains of `concat()` and `map()`.
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