If multiple splines are branching off the same output pin of a function, is the function recalculated for each branch or do they simply refer to an implicity stored local variable?

I know that for functions that have an exec pin, having multiple branches off of an output pin does not recalculate the function (for example, having multiple branches off of the hit result of a line trace won’t run the trace multiple times). On the other hand, functions that do not have exec pins but have a non-deterministic output based on the input will re-run the function again (for example, if you have two branches coming off of GetActorLocation, but SetActorLocation is called before the second branch is used, then sensibly each branch will return a different value). What I want to know is if a function does not have an exec pin but its output is deterministic based on its input (adding the same two vectors will always yield the same result), will it follow the first behavior type or the second?

The reason for this question is that my current project contains many complex vector calculations that are done every tick, in which I have many instances of multiple splines branching off of the same output pins and have realized that if the functions are recalculated for every branch then many unnecessary calculations are occurring. This situation is very solvable with the implementation of local variables, but I want to know if it is necessary because refactoring most of my current blueprints will take a while.

(In case its not clear, whenever I talk about branching, I am referring to pulling multiple splines off the same (non-exec) output pin, rather than the “Branch” flow control node)

Few times I have checked source files after packaging with enabled blueprint nativization, and result of every function is always stored in some variable, so yes, function called once and result used for all further calculations.

You can check it by yourself. Enable blueprint nativization in project settings and package it. Source files will be located in Intermediate folder.

■■■■ dude you’re right! I just tested the nativization process with several different graph configurations in a custom project. It seems that non-exec-pin functions are are run (and their output stored in an implicit local variable) once per exec-pin function that they are connected to (either directly or indirectly through other non-exec-pin functions).

In fig 1, the collection of non-exec-pin functions are connected to a single exec-pin function, and so the “+ 10” node is run only once and its value stored even though it is connected to two other nodes. In figure 2 however, although the output of the “+ 10 node” is always the same, due to the fact that it is connected to two exec-pin functions, it is run twice.

This is perfect behavior, the guys at Epic are geniuses.