I traced a major performance bottleneck in my SceneKit app to a nested loop being run a few thousand times. In that loop is a bunch of code that zooms along quite happily, apart from this one line:
var scenePos = presentation.position
It's over 100 times slower than just asking for the position PLUS dozens of other calculations, comparisons, array lookups & method calls combined that I was doing inside the same loop. I'm surprised no-one seems to have commented on this yet that I can find.
Why is this, and is there a workaround for it apart from making a copy of each node's presentation.position yourself each frame so you don't have to keep asking the presentation node for it? Thanks.
from Why is SCNNode.presentation.position so relatively slow, and is there a workaround?
No comments:
Post a Comment