2

Ok so I'd like to place a large number of skspritenodes on screen. In the game I'm working on and even in the sample twirling spaceship game the cpu usage runs high in the simulator. I'm not sure how to test my game on an actual device (unless I submit to apple) but I'd like to know whether having something like 50-100 nodes on screen would use too much CPU time.

I've tested putting out large numbers of skspritenodes and the cpu usage reads 90% or more. Is this normal? Will I get laughed at if I hand Apple this game based on the extremely high (and growing) amount of CPU usage for this game?

Lastly, is there a way to avoid lagging during different points in the game? Arching? Preloading textures? idk, something like that.

Dominique Vial
  • 3,729
  • 2
  • 25
  • 45
Dante Hoyte
  • 333
  • 2
  • 15

1 Answers1

1

Performance results seen in simulator are not relevant at all. If you are interested in real results, then you should test on different devices.

From the docs:

Rendering performance of OpenGL ES in Simulator has no relation to the performance of OpenGL ES on an actual device. Simulator provides an optimized software rasterizer that takes advantage of the vector-processing capabilities of your Macintosh computer. As a result, your OpenGL ES code may run faster or slower in iOS simulator (depending on your computer and what you are drawing) than on an actual device. Always profile and optimize your drawing code on a real device, and never assume that Simulator reflects real-world performance.

On the other hand, SpriteKit is capable to render a hundreds of sprites at 60fps if you are using texture atlases to draw many nodes in a single draw pass. Read more here.

About preloading textures into memory you can check :

Preload Texture Atlas Data section

and

+ preloadTextureAtlases:withCompletionHandler: method.

Hope this helps.

Community
  • 1
  • 1
Whirlwind
  • 14,286
  • 11
  • 68
  • 157
  • Also, I know you said there is no point paying attention to the cpu usage, but if there are spikes of usage that go to almost 200% is that something to worry about??? – Dante Hoyte Aug 08 '15 at 11:34
  • Actually I said there is no point to pay attention on simulator at all when it comes to performance. Test your app on real device, simulator results are irelevant because end user will run an app on actual device not on simulator. If you get similar results on actual device, then, I guess, you should be worried because of high resource usage. – Whirlwind Aug 08 '15 at 11:48