What is this Performance mode used for? And how it can help with performance?
-
$\begingroup$ Not sure, so logging this as a comment rather then an answer: in the background, animation nodes performs code generation. By default, it will generate code to create a copy of all incoming sockets for a given node. When you put a node in "performanc" mode, only the selected sockets are code generated, other sockets will use their default values and generated code will assume you are only using the default values for that socket. In summary, it optimises the generated code to make it faster. I'm sure Jacques can/will elaborate more... $\endgroup$– Kristof MeirlaenOct 16, 2016 at 13:15
1 Answer
It's true what Kristof Meirlaen said for the most part. Animation Nodes will not copy all incoming sockets for a given node (that would be extremely ineffecient). The input data will only be copied when it is used by multiple nodes AND at least one of the nodes that uses the data modifies it. So when a single output is only connected to one input, the data will never be copied (an exception is the Loop Input node when you turn on "Copy" in the advanced settings).
Wether a node modifies the incoming data is stored in the input sockets of each node. The nodes specify this themselves. Each socket has a property that is currently called "dataIsModified". This is the property you can edit when you switch to "Performance" (it is only available for data types that can be copied).
In fact I did not want to make this "feature" that prominent (and it will likely change) because you really almost never need it. I mainly implemented this for me for testing. I never really used it in practice.. Performance problems are somewhere else most of the time.
If you have a big node tree and want to see where data is copied automatically you can switch the "Color Mode" in the Developer panel of AN to "Needed Copies". That is also a feature I mainly implemented for me, but it might help you in some cases..)
In summary (although it might not satisfy you): You really don't need this. AN should be able to optimize itself in that regard. When you try to optimize performance, you should look somewhere else. I will remove/hide that "feature". Thanks for opening my eyes on it :)
-
$\begingroup$ Aha, I see, that's why I cannot find a performance boost by tweaking that so far. :) Thanks for that comprehensive explanation. $\endgroup$ Oct 16, 2016 at 23:47