Announcement

Collapse
No announcement yet.

Multi-cast delegates vs function access in loops: Runtime performance

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Multi-cast delegates vs function access in loops: Runtime performance

    I'm using loops which iterate over
    Code:
    TArray<UMyActorComponent*>
    to call functions in different UActorComponents. I've discovered just recently, that multi-cast delegates offer similar possibilities.

    Would it improve the runtime performance, if I remove the loops and use multi-cast delegates instead (so I won't have to iterate over a TArray to access each function). Or are multi-cast delegates not faster in that regard?
    Last edited by Roi Danton; 05-14-2017, 06:34 AM.
    Client side prediction with GameplayAbilitySystem | GameplayAbilitySystem at stackoverflow

    #2
    Considering the multi-cast delegate still has to iterate over each bound function to call them, I'd guess there is no meaningful difference.

    The delegates would probably be slightly slower because the compiler can't optimize them as well as a simple loop calling the same function on a few objects.

    Comment


      #3
      Originally posted by Zeblote View Post
      Considering the multi-cast delegate still has to iterate over each bound function to call them
      Thanks for the input! I will stick to the loops.
      Client side prediction with GameplayAbilitySystem | GameplayAbilitySystem at stackoverflow

      Comment

      Working...
      X