Skip to content

Conversation

@kartik815
Copy link

@kartik815 kartik815 commented Nov 30, 2025

Optimize Receiving Objects Step to Reduce Initialization Delay (#842)

Description

This PR addresses issue #842 by improving the performance of the receiving objects step in the engine.
It reduces the delay when processing incoming objects, ensuring smoother initialization and better overall responsiveness.

Fixes #842

Checklist

  • I have read the contributing guidelines
  • My code follows the project's coding standards
  • This PR focuses on a single change

@kartik815 kartik815 closed this Nov 30, 2025
@kartik815 kartik815 reopened this Nov 30, 2025

for (let j = 0, m = buttons.length; j < m; j++) {
const button = buttons[i];
const button = buttons[j];
Copy link
Member

Choose a reason for hiding this comment

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

did you mean to change i -> j?

Copy link
Author

Choose a reason for hiding this comment

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

Yes — this change was intentional.
The inner loop iterates using j, but the original code accessed buttons[i].
That caused incorrect indexing since i belongs to the outer loop.

This was a small existing bug that I fixed while making the main change (in-place axes updates).
If you'd prefer, I can move this fix into a separate PR

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.

game-pads.js allocates a new array every frame

2 participants