In a game I'm writing, I noticed that generating the contents of each level is really slow. There was like a 1-second delay when creating even a simple scene with under a hundred sprites.
When I started measuring where this slowness is coming from, it turned out that the culprit was [SKSpriteNode spriteNodeWithImageNamed:].
It's incredibly slow. Creating something like a hundred sprites like this takes over a second on the Apple TV.
I noticed that sprites support copying. Thus I tried what happens if I create a sprite only once and then copy it a hundred times. This was extremely fast (a tiny fraction of a second.)
I ended up creating a sprite caching scheme where I create sprites only once and store them in a map based on their name, and then if a sprite with the same name is created again, it just copies the cached sprite. This improved the speed of the level generation enormously.
But one would think that SpriteKit would itself do this already. But apparently not.
Is [SKSpriteNode spriteNodeWithImageNamed:] really supposed to be that slow? I have never noticed such a thing with cocos2d.
This makes me think how slow it makes loading an .sks file. (Unless the .sks loader performs some similar optimizations.)