main does a loop, and every iteration it increments a tick by one
For example, say it were in python because that's easy to write:
tick = 0
tick += 1
I want to trigger many different events every n-in-x ticks.
So I could skip nine-out-of-ten ticks using modulus:
if ticks % 10 == 0:
My worry is that doing a modulus operation is generally expensive in computing. (I'm guessing its expensive because colleges tell me division in general is expensive)
If I had, say a thousand [oh okay a hundred-billion] different cases, I wouldn't want to spend any excess time just qualifying tick cases.
But I also want each case to be ignorant of all the other cases.
So I'm curious what others may recommend as a super-efficient pass-n-out-of-x-ticks.
Note: Python is just for an example, I am not interested in python-only concepts.