Timers are actually quite expensive, energetically.
Every nanosecond during which the OS (or the applications running on it) do nothing, the CPU does not work in one of several low-power modes. Exiting a system from an idle state entails energy costs when the CPU and other systems exit a state of low power consumption. If the timer causes the system to wake up, it carries that cost. The more often the timer fires, the higher the cost of energy. On mobile devices, this can significantly affect battery life.
In this sense, itβs much more efficient to wake up the system once, do all the work, and then let it sleep as much as possible. Returning to your example, if you profile this, it will be more efficient to use 1 timer rather than 20 timers, each of which is triggered 100 times per second.
Later versions of the OS allow you to specify the tolerance (in%). This allows the system to group timers and run them at the same event in order to save energy. It seems that what you are doing is not time critical (in the sense of real-time execution), so allowing clearance (e.g. 10%) should help.
Example: [myTimer setTolerace:0.3];
More on timer tolerance here: https://developer.apple.com/documentation/foundation/nstimer
source share