As you can see on the image. In this case, is the multiply node (and everything linked to it before) executed twice? If so, then from optimization perspective it’s better to save this to a local variable and then reuse it - so this way it would execute only once, and then access already calculated value from local variable.
… But maybe there is some automatic optimization happening already? Has anybody have an idea on how this works? Cheers!
In this example, because the section commented in purple is begin called by the red and blue execution function/macros, they will run their calculations twice.
Where as the float x 2 calculations that are commented in blue only get called once because they are only called by the section function/macro also highlighted in blue.
Below I’ve tried to highlight the flow, where you will see the first calculations are highlighted twice:
If you have a node without execution pin, the code that is connected to that node will fire the amount of times you connected its output to other nodes. To prevent it from executing multiple times you have to promote the output to a variabele.
Actually, in the first example all pins lead to the same node with execution pins while the second example there are two nodes with execution pins. He means that no matter how many inputs the node has, all the pure and const nodes for that one node could be cached and executed only once but as soon as you go through an execution pin the answers are clean and calculated again for the next node.