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

perf: Allow components to have null children #1231

Merged
merged 2 commits into from
Dec 16, 2021

Conversation

st-pasha
Copy link
Contributor

Description

The Component.children property can now be null.

The reasoning is simple: most of the components in the game tree are leaf nodes, and don't have any children. For these components carrying around a ComponentSet object is wasteful.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, doc: etc).
  • I have read the Contributor Guide and followed the process outlined for submitting PRs.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples.

Breaking Change

  • No, this is not a breaking change.

Related Issues

Copy link
Member

@spydon spydon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might be premature optimization (especially without benchmarking), or have you actually faced a problem with this? In some cases it will actually make your game less performant, since it can create the component sets outside of onLoad with this change. I'm okay with having this merged anyways though since the scenario you describe is way more common.

@spydon spydon merged commit 66ad4b0 into flame-engine:main Dec 16, 2021
@st-pasha st-pasha deleted the ps/childless branch December 16, 2021 15:55
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.

3 participants