Skip to content

Performance improvement for static or sleeping bodies.#903

Open
eyeseet wants to merge 1 commit into
liabru:masterfrom
eyeseet:master
Open

Performance improvement for static or sleeping bodies.#903
eyeseet wants to merge 1 commit into
liabru:masterfrom
eyeseet:master

Conversation

@eyeseet

@eyeseet eyeseet commented Aug 11, 2020

Copy link
Copy Markdown

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

eyeseet commented Aug 11, 2020

Copy link
Copy Markdown
Author

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.

1 participant