I’m not super certain on the efficiency of Timers so I wanted to know for NativeUpdateAnimation in a UAnimInstance, which of the following are more efficient for updating a variable that can cannot be updated more frequently than every 0.1 seconds (in this case, bReceivedInitDir)?
don’t be much sensitive on performance and optimization
you surely have bigger bottlenecks. for instance a high poly mesh without LOD drops the FPS too bad.
but the first one is better in my opinion. (though it depends and I feel like you didn’t implement it right).
because it has less computation and the memory that ‘this’ refers to is more likely in the CPU cache since you are already changing the member variables.
btw the timer was not used well. GetWorld()->GetTimerManager().IsTimerActive does lots of check every frame. you can simply start the timer in NativeInitilize with loop enabled.
if you want spacial interval in your loop maybe this one could help you.
I’d guess technically the first approach could be faster (some really detailed reading on pointer vs variable access speed if you’re interested) but I doubt it would matter in any significant way.