Skip to content

Performance improvement in render method #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Lukenickerson opened this issue Apr 26, 2024 · 0 comments
Open

Performance improvement in render method #28

Lukenickerson opened this issue Apr 26, 2024 · 0 comments

Comments

@Lukenickerson
Copy link
Contributor

While working on a game with a larger number of vertices, I found there was a performance bottleneck that was slowing down the rendering. When I investigated in the Chrome developer tools, I saw that toString was taking a lot of processing. I narrowed it down to this line: https://github.com/xem/W/blob/gh-pages/w.js#L337 For some reason when instantiating a DOMMatrix this way, there's some kind of implicit string conversion. (No idea why!❓)

Here was the change that improved the performance: morph-games/ring-rescue@2822a62#diff-9b7c0300e9f9c7a72e91a5f2890bd540663ae785b5c582a7b3ae15fac823bd6eR379

I can make a PR for this.

FWIW - The next bottleneck seems to be toFloat32Array, but I don't know if we can get around that without reimplementing some matrix math, which would take a lot of bytes.

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

No branches or pull requests

1 participant