title: SKLightNode performance issues
body: <p>I've been experimenting with <code>SKLightNode</code> in SpriteKit (new in iOS8) and, even in a really simple test case, I've been getting terrible performance. For instance, with a <strong>single light source</strong> on a <strong>solid color <code>SKSpriteNode</code></strong> I get <strong>13.2 FPS</strong> on a <strong>3rd generation iPad</strong>. If I add a <strong>second light source</strong>, it drops to an abysmal <strong>7.7 FPS</strong>.</p>
  
  <p>The WWDC session video <em>What's New in SpriteKit</em> mentions that you might get less than 60 FPS if you have more than one light on the same sprite, but I can't even get 60 FPS with one. <a href="http://asciiwwdc.com/2014/sessions/606#t=1479.0" rel="nofollow noreferrer">Here's the relevant section.</a></p>
  
  <p>Here's my test scene in swift (it starts with one light source and more can be added by tapping):</p>
  
  <pre><code>class GameScene: SKScene {
      override func didMoveToView(view: SKView) {
          let center = CGPointMake(size.width / 2.0, size.height / 2.0)
  
          let background = SKSpriteNode(color: SKColor.lightGrayColor(), size: size)
          background.position = center
          background.lightingBitMask = 1
          addChild(background)
  
          let light = SKLightNode()
          light.position = center
          light.falloff = 1.0
          light.lightColor = SKColor(hue: 0.62 , saturation: 0.89, brightness: 1.0, alpha: 0.4)
          light.shadowColor = SKColor.blackColor().colorWithAlphaComponent(0.4)
          addChild(light)
      }
  
      override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
          for touch: AnyObject in touches {
              let location = touch.locationInNode(self)
  
              let light = SKLightNode()
              light.position = location
              light.falloff = 1.0
              light.lightColor = SKColor(hue: 0.62 , saturation: 0.89, brightness: 1.0, alpha: 0.4)
              light.shadowColor = SKColor.blackColor().colorWithAlphaComponent(0.4)
              addChild(light)
          }
      }
  
  }
  </code></pre>
  
  <p>Here are some screen shots of it running on my 3rd gen iPad:</p>
  
  <p><img src="https://i.stack.imgur.com/TtKtO.png" alt="1 light source">
  <img src="https://i.stack.imgur.com/wvQq4.png" alt="2 light sources"></p>
  
  <p>And here's what the performance tab looks like after clicking the "Analyze" button when it's running with a single light source:</p>
  
  <p><img src="https://i.stack.imgur.com/4oXYj.png" alt="performance analysis"></p>
  
  <p>It's obviously GPU bound, but what I'm trying to figure out is if I'm just doing something horribly wrong, or if this is just an issue with the beta that will (hopefully) be cleared up by release time. I'm currently using Xcode6-Beta5.</p>
  
  <hr>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I upgraded my iPhone 5S to iOS8 and tried the same thing there and it ran perfectly fine at 60FPS with 8 light sources. So, I guess this is just an issue with the 3rd generation iPad's GPU just not being up to the task. I'll try again after the next beta is released and see if anything changes, just in case.</p>