Iterate timers list using an index instead or pairs

* Timers list is an array (of ticks), so it can be iterated using an
index. Iterating an array using an index is faster than using pairs.
* Benchmark selftest execution time. The test is now 44% faster.
* Some code refactoring.