-
Notifications
You must be signed in to change notification settings - Fork 555
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We currently emit a 'Move' event when the position is set, and a separate 'Moved' event when the position is set by the 'Motion' event. (I believe this is baggage left over from how Multiway/etc used to work?) This has a fairly high cost, since on a typical motion tick we emit 4 events, two for each axis. This PR simplifies things by - Removing the 'Moved' event completely - Adding a method that handles both x and y change in one pass. The result is that linearMotionTick will only emit one move-related event per frame. In limited performance testing, this had a fairly large impact. In a test involving several hundred falling entities, linearMotion + event callbacks went from consuming 13% of the total CPU time to 5.5%.
- Loading branch information
Showing
3 changed files
with
33 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters