From AristosQueue: "In the case of shared variables, the cost of comparing "are these two values equal" is always more expensive than just doing the copy. Why? Because either you are reading the current value across the network and doing the compare locally OR you are sending the new value across the network and paying the cost of unflattening the data (which means you've already made the copy) and then adding on top of it the cost of doing the comparison. For local and global variables, the cost of the compare is usually more expensive than the copy. If the new value is different the majority of the time, then it is always less efficient to do the compare. If you want that highly specialized functionality, it is better to add it to a specific network shared variable and for you to manage some sort of local knowledge for when the value has changed. This is not functionality that should be generally on the variables, particularly not the shared variable."
Add option to local, global and shared variables to write only if data changed.
Seems like checking if data has changed might add quite a bit of overhead to a simple write operation. What is the harm in overwriting with the same value?
Why overhead? It would be just an option. And sometimes when you want to set flag shared with other loops or want write shared variable (= slow) it can be useful and diagram simpler and more readable.
mbabik: In the case of shared variables, the cost of comparing "are these two values equal" is always more expensive than just doing the copy. Why? Because either you are reading the current value across the network and doing the compare locally OR you are sending the new value across the network and paying the cost of unflattening the data (which means you've *already* made the copy) and then adding on top of it the cost of doing the comparison.
For local and global variables, the cost of the compare is usually more expensive than the copy. If the new value is different the majority of the time, then it is always less efficient to do the compare.
If you want that highly specialized functionality, it is better to add it to a specific network shared variable and for you to manage some sort of local knowledge for when the value has changed. In my opinion, this is not functionality that should be generally on the variables, particularly no the shared variable.
From AristosQueue: "In the case of shared variables, the cost of comparing "are these two values equal" is always more expensive than just doing the copy. Why? Because either you are reading the current value across the network and doing the compare locally OR you are sending the new value across the network and paying the cost of unflattening the data (which means you've already made the copy) and then adding on top of it the cost of doing the comparison. For local and global variables, the cost of the compare is usually more expensive than the copy. If the new value is different the majority of the time, then it is always less efficient to do the compare. If you want that highly specialized functionality, it is better to add it to a specific network shared variable and for you to manage some sort of local knowledge for when the value has changed. This is not functionality that should be generally on the variables, particularly not the shared variable."