Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Optimization: Shared SKTexture #8
Learned a new thing this week, that you can significantly reduce memory usage and draw performance in SpriteKit by sharing an SKTexture between all similar nodes.
In the case of Life Saver, this means there's only one texture stored in memory. On launch, this results in a 50%+ reduction in memory usage... with the small square setting starting memory usage is ~94 MB. After this optimization, starting memory usage is ~44 MB.
Additionally, per-frame draw count goes from 576 down to 1. This is pretty amazing.
In this PR I also remove the debug label from nodes, it was using unneeded memory. I could have set a flag to toggle its generation but really it's not needed at this point.