Is there significant overhead on an otherwise-empty tick function?

Let’s say I’ve got an event tick that pipes immediately into a branch, and the branch is almost always routing it to nothing except for some special circumstances. Like this:

As a software engineer who usually works with more traditional languages, I’d figure a boolean evaluation is functionally free, it’ll be like single-digit nanoseconds max. As long as I don’t hit “Do Stuff For Real” I could do this ■■■■ all day and not cause a performance impact.

But my question is, am I wrong? Is there some hidden cost to a tick which “isn’t doing anything”? Or is this as cheap as it looks?

Having tick enabled on an actor does add a small cost, even when there is nothing connected to the event.

Believe that cost of having an actor ticking depends if you really need that actor to tick. More often than not you can get away with stuff being event driven.

This might be helpful to the debate:

1 Like

Use SetActorTickEnabled instead which is already doing this check behind the scenes.

1 Like