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

Performance improvement for static or sleeping bodies. #903

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eyeseet
Copy link

@eyeseet eyeseet commented Aug 11, 2020

Loop only non-static/non-sleeping bodies 8 times instead of all bodies. At the cost of one extra loop in Engine.update. Estimate is improved performance when >12% of bodies is sleeping or static.

…static/non-sleeping bodies 8 times instead of all bodies. At the cost of one extra loop in Engine.update. Estimate is improved performance when >12% of bodies is sleeping or static.
@eyeseet
Copy link
Author

eyeseet commented Aug 11, 2020

From what I understand from the documentation https://brm.io/matter-js/docs/classes/Body.html#property_isSleeping static bodies can be threaded as if sleeping and vice versa. In this case further optimizations are possible such as:

  • Sleeping.update function.
  • Only one array to track either sleeping or static bodies (instead of one for each) in Engine.update.
  • Also several check in the loops of the methods that get bodies passed as parameter can be improved.

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.

None yet

1 participant