I have a JS app that uses setInterval to update itself many times a second. Most of the time it’s not doing anything and is not very CPU intensive. I have heard people say that JavaScript timers can eat up battery life on mobiles, but I have not seen any facts or evidence.
Is there any good way to measure the battery drain of my JS app on iOS? Or could someone explain how using setInterval to call a non CPU intensive function would be draining the battery faster?
setInterval wakes up the CPU each time it runs. How many times per second are you talking? If it’s more than 10 you should find a different solution, setInterval is the wrong tool for the job.