Skip to content
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

Optimization: Shared SKTexture #8

Merged
merged 1 commit into from Jun 8, 2019

Conversation

Projects
1 participant
@amiantos
Copy link
Owner

commented Jun 8, 2019

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.

@amiantos amiantos merged commit 0e78180 into master Jun 8, 2019

@amiantos amiantos deleted the optimize-sktexture branch Jun 8, 2019

@amiantos amiantos added this to Done in Screensaver v1.1 Jun 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.