Skip to content

Optimized Events.trigger method when no event is emitted - #553

Merged
liabru merged 1 commit into
liabru:masterfrom
bchevalier:optim-events-trigger
Jun 12, 2018
Merged

liabru merged 1 commit into
liabru:masterfrom
bchevalier:optim-events-trigger

Conversation

@bchevalier

Copy link
Copy Markdown
Contributor

For my particular use case the Events.trigger method was taking roughly 5% of the resources of the physics engine even though no event was emitted. This brings it down to >1%.

It is a small overhead when events are used though. However I think that one sound logic is to accept overhead for optimizing out optional features as they will rarely all be used.

@liabru

liabru commented Feb 10, 2018

Copy link
Copy Markdown
Owner

Looks fine, but can you change this to use Common.keys instead of Object.keys (for consistency and compatibility)? Thanks!

@liabru
liabru merged commit b17cb48 into liabru:master Jun 12, 2018
@liabru liabru mentioned this pull request Dec 26, 2020
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.

2 participants