SceneKit CPU Usage

Hi,


I am new to the iOS programming.

I write a game which uses Scenekit and Swift 4 and I am wondering weather my CPU usage is not to high so that the app will be rejected in the future.

Right now I have 50-70% of the CPU usage and battery usage high.

I don't know what CPU usage should I target in case of the game.

Unfortunatelly battery usage is high as well.

I can try to do some optimizations, but maybe this is an acceptable performance?

The device on which I am testing is not hot and I have 50-60fps performance and the game works smoothly.

Does anyone has any ideas?

Accepted Reply

I think you need to experiment, and use performance tools such as Instruments.


For example, if using smaller (or lower resolution) images dramatically reduces CPU use, you might focus on that area.


It also depends on (for example) whether users will play your game for long periods of time. If the battery drains quickly, they won't be able to play for very long.


One question: when you test, are you using a Debug build from Xcode, or a Release build? With Swift, this can make quite a difference.

Replies

Sorry for my english, there should be and I wonder.

I think you need to experiment, and use performance tools such as Instruments.


For example, if using smaller (or lower resolution) images dramatically reduces CPU use, you might focus on that area.


It also depends on (for example) whether users will play your game for long periods of time. If the battery drains quickly, they won't be able to play for very long.


One question: when you test, are you using a Debug build from Xcode, or a Release build? With Swift, this can make quite a difference.

I test using a Debug build from Xcode, I changed to a Release build but now in XCode I don't see usage of the CPU and battery anymore 😟

I need to read how to use instruments.

I don't think that my app drains battery as I am playing my game during the day 1-2 hours and the battery level does not drop down very fast, the same as if I were browsing the web.

I have a particle system that renders 5000particles and I noticed that it uses 20% of the CPU however the effect is very nice and I don't want to get rid of that.

Do you think that if I write a metal shader to achieve the same effect it will be better?

Thanks for the advice with the texture resolution, I already downsized them but in the debug build it makes no difference.

Ok I have run the Energy Log from instruments and it shows CPU usage 20-41% and GPU usage 7-10%.

Thanks for help 🙂