A friend of mine said that he read somewhere that in case of complex objects, pure casts have a performance hit as opposed to impure casts. Can anyone tell me if this is true, and if yes, is there any documentation on it?
I have nothing to support this other than a tutorial that I can’t name at this time, but what I heard was the exact opposite.
That’s interesting… I imagine there shouldn’t really be ANY difference but it’s still better to double check.
I have tested tens of thousands of casts, with no performance difference between pure and impure. Obviously I suppose it depends on a lot of different factors (Which items I am casting to, whether or not the casts succeed, etc.), but that is just what I found.
As far as I remember, pure nodes get called (and everything on the “left” gets executed) each time something is called on what they return, while impure nodes only execute once when they are executed. So if you have a pure cast node and then call 10 functions on the actor (or whatever other thing), it’s casted 10 times, while an impure cast node would only cast it one time and then store the reference to the casted actor.
So the impure one is more efficient.
I feel like the name(s) “pure” and “impure” are deceptive if this ^ is the case. Your explanation makes sense to me, thank you for your insight. I am still skeptical about this whole thing (not in your explanation, just skeptical about what’s happening under the hood with all this). If I find any more useful info ill be sure to drop it in here. Thanks!