We've used tickcount%n = 0 to save n times the performance, but what happens if we use tickcount%n = 1?
Divide your work
Each frame can process as much things as the CPU allows. Using the tickcount%n = 0 has its limits. If you put all of your heavy stuff every n frames, then you'll just have a lag spike every n frames.
Instead, divide your work. The number you put after the equal sign is actually the offset from the nth frame. So if you do some work on tickcount%2 = 0 and some on tickcount%2 = 1 then you'll alternate between doing one work then the other over a 2 frames period.
That's not all, if you need to loop through a lot of objects (say AIs), you can instead decide on what frame offset to update them and divide which AIs get updated at any given frame.
A simple way to do this would be to give a new variable to your AI objects and set that value between 0 and n-1. Try to make it so the objects are evenly distributed. Then, right before your for each loop, pick every AI Object that has its update value set to tickcount%n. That way it will only pick the objects that were tagged to be updated on this frame and loop over them.
That way, you still save n times the CPU usilisation overall, but you ALSO avoid random lag spikes !