Skip to content

Conversation

@mariovisic
Copy link
Contributor

Improve the performance of the render-perf-tiles test by using a singleton
color object rather than creating a new color each time. On my machine this
took the FPS of that test from 26FPS to 39FPS. A 50% improvement

The Tileset#render indentation was broken, so that's why the diff is a bit big.

The two major changes are:

  • Do not create a new color object for each vertices render (this occurs for each tile in a tileset)
  • Use an if/else for figuring out if vertices needs to rotate or not, calling a method and creating a new array object can have a large effect when it's called 10 000s / 100 000s of times per second

Improve the performance of the `render-perf-tiles` test by using a singleton
color object rather than creating a new color each time. On my machine this
took the FPS of that test from 26FPS to 39FPS. A 50% improvement
@mariovisic
Copy link
Contributor Author

@mariovisic mariovisic merged commit 1eb3ce5 into main Feb 11, 2022
@mariovisic mariovisic deleted the tileset_performance_tweaks branch February 11, 2022 06:01
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.

3 participants