Download

Timer vs Tick

Hey guys,

I have a simple question about update functions. There are a lot of threads about this topic, but non of them did a real side by side comparison.

What I want to do:

I need to update some audio related calculations. As they do not need to be updated every frame, I wanted to save some performance on them and set a custom update interval.

What I came up with:

  1. Timer: The first idea was to use a looped timer and set the time with a float value to adjust the timing as needed.
  2. Tick: The second idea was to use the regular tick, but change its interval as needed.

What I’m wondering:

Is there any difference in case of performance between these 2 setups? The timer is just started once at the beginning and keeps on looping from there on. But what about the tick? Usually it’s based on FPS, which will vary. Will the “Set Actor Tick Interval” node set the tick timing to a static interval, for example 10 times / sec? Or is ist still firing with like 60 FPS at the “Set Actor Tick Interval” node and the “Set Actor Tick Interval” node just passes through some ticks based on the float time?

Tick Events depend on the framerate of the machine it is running on, so may give different outcomes per machine. Set Timer should be an exact timing rather than using the FPS it is running at.

As far as I understand, the “Set Actor Tick Interval” node (see my screenshot above) should set the tick to a fix ticking rate. Therefore it should not be depending on FPS anymore.

If my assumption is correct, I’d like to know if there is any performance difference compared to a timer, which is also ticking with a fix rate.

Timers have several benefits over Tick.

  1. They can skip condition checks when not needed as one class keeps track of all timers running.
  2. All timers are listed in a sorted list so they will always be executed in the same order unlike Ticking Actors in the same group.

So my conclusion is:

  • Use Tick for ticking every frame with or without interruptions.
  • Use Timers for everything else.

PS. Remember that using Tick in Blueprint is expensive and 9/10 times things you think needs to Tick actually works just fine with 60, 10 or just 1 FPS. Even rendered things like Animations or UI don’t have to update >60 times a second. Could be much less.

I think you guys are missing my point.

When I use the “Set Actor Tick Interval” node and set the tick interval to 0.1, it will tick 10 times a second and isn’t related to FPS anymore. So i basically just created a static timer.

And now I’m wondering what’s the performance difference between a timer ticking 10 times a second and a modified tick ticking 10 times a second. I need them to run throughout the entire game.

Tick can’t skip the interval check but if it Ticks every frame it doesn’t matter anyway because there is nothing to skip.

A Tick set to an interval is less efficient than a Timer. You should use a Timer.

In your very specific case I’m not sure about the performance difference. However, notice that if you use a timer that only affects the audio calculations, you are free to do whatever you want without fear of affecting anything else in your BP.

If you constantly modify tick, it will affect all operations that rely on tick in that BP.

My advice- use a timer even if performance is the same.