Skip to content

Conversation

@ngokevin
Copy link
Member

Description:

Objects and strings were being created on every button touch, press, and up.

Changes proposed:

  • Cache event details.
  • Use constants versus concatenating strings for event names.

this.axis.push(controllerAxes[i]);
}
this.el.emit('axismove', this.axisMoveEventDetail);
this.el.emit(EVENTS.AXISMOVE, this.axisMoveEventDetail, false);
Copy link
Member

Choose a reason for hiding this comment

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

I’m ok with the PR but I believe these strings should be allocated on stack and not on the heap so no subjects for GC

Copy link
Member Author

Choose a reason for hiding this comment

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

I read strings get collected. But this PR also removes the string concatenations which do allocate and are messy anyways, constants are cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants