Multiple node output links == multiple executions?
Hey, I'm still not sure how it works:
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!
asked Apr 24 '17 at 01:43 PM in Blueprint Scripting
Long answer short: Yes it is executed twice.
In their last livestream getting started with code or something like that, they talked about pure functions and this.
If you want it to be only calculated once you have to store it in a variable.
answered Apr 27 '17 at 08:38 AM
From what I can tell from your graph I believe you should only be executing it once.
I can't remember where the flow explanation was but from memory it works something like this:
Once an execution node is called it started from the calculation furthest back and than calculates forward. So the multiplication is called only once.
Below is an example of when it would have to calculate it twice:
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:
Follow this question
Once you sign in you will be able to subscribe for any updates here