02-13-2015 07:35 AM
Hello AF community,
looking at the Stop Core.vi in Actor.lvclass, I wonder why the Swap Values function is used on the array of Nested Actors? Why not directly wire the unbundled wire and the empty array to the For Loop and bundling function, respectively?
Best regards,
Mat
Solved! Go to Solution.
02-13-2015 07:45 AM
Mat,
just guessing... I still haven't upgraded
When swapping the array you make sure that the nested Actors are stopped in the opposite order as they have been launched... so last launched is being sent Stop first.
02-13-2015 02:16 PM
Oli: No. Swap Values does not affect the values inside the array.
Mat: It is my style. To me, it makes it clearer what my intent is. I'm taking the array away from the object that is carrying it and replacing it with an empty array. There are times when Swap Values provides a clear signal to the LabVIEW compiler of the programmer's intent that lets it do better optimization -- I am pretty sure this is NOT one of those cases. This is just me coding in a way that documents the model that is in my head.
02-16-2015 12:42 AM
Thank you, that makes sense to me now.
Can the presence of the Swap Values fonction actually degrade the compiler's efficiency?
Best regards,
Mat
02-16-2015 12:47 AM
AristosQueue schrieb:
Oli: No. Swap Values does not affect the values inside the array.
Sorry, mixed something up there
02-16-2015 09:42 AM
Matjö wrote:
Can the presence of the Swap Values fonction actually degrade the compiler's efficiency?
Only if there's a bug in the compiler, but then, that's true of any bit of code. 🙂 Assuming we have our compiler code right, expressing a swap operation using a Swap Values should always improve the efficiency or leave it unchanged.