The short answer — in case of thermal throttling. I’ll be focusing on mobile devices in this article. Most of the mobile devices can work not so long on maximum capacity before they hit throttling. After throttling, CPU & GPU clock speed can be cut in half to prevent device overheating. This makes profiling and optimization extremely hard since you can’t see the same outcome during tests.
BTW this is why you should not trust mobile benchmarks a lot. Most of the times, games will not utilize full CPU/GPU potential 😰
Most of the times I have problems with mid-range devices. The reason is that very old devices often have fixed frequencies. High-end devices are not affected so much because current code is not too demanding for them, so they can run games easily. Mid-range devices throttle very hard. Usually, code optimized for them to perform on 30 FPS, but after 2–3 minutes of running code with full CPU utilization device got throttled and main thread execution dropped from 33 ms to 40–50 ms.
Who to blame? CPU and GPU can contribute to device overheating. However, the workload on GPU can often be scaled according to device Hardware Tier, Shader Model / Graphics API version and etc. We can stream different LODs, use variable shaders and so on. GPUs designed to work on maximum capacity, so you want to push your visual to the maximum and be slightly GPU bound almost all the time. Unlike GPU, CPU workload usually the same across various devices and is hard to scale. In most cases CPU is the reason for throttling and if device overheated really bad GPU frequency dropped as well.
How to deal with thermal throttling:
- On modern device use Sustained Performance mode, starting Android 7.0 which will not help on the mid-range device — https://source.android.com/devices/tech/power/performance
- Preheat your device before profiling, let it run for 5–10 mins. Or implement some kind of heavy load scene to push the device to the limit.
- Note that device can throttle much fast in users hand than when laying on cold table ¯\_(ツ)_/¯
- Try aim for 15–20 ms per frame on a mid-range device, that way after throttling will hit you still be in 33 ms range.