09-24-2019 05:41 AM
@nathand wrote:
I have no idea about the details of the LabVIEW compiler, but according to everything I've read, yes, there's no performance difference between those two pieces of code.
Yes and no. It depends.
If the compiled code complexity raises above a certain threshold, the LabVIEW compiler will be forced to suspend certain optimisations. This can happen by widespread usage of inlined VIs for example. Problematic is that the "displayed" Code complexity for such a VI will seem small, but the compiler, when extracting the inlined code will soon hit a barrier and start limitinf compiler optimisations. If the magic pattern of unbundle-bundle happens to be affected, you will see some big differences between those two pieces of code. The IPE will ALWAYS be in-place. The unbundle-bundle will NEARLY ALWAYS be in-place. Be aware of the differences.
09-24-2019 06:40 AM - edited 09-24-2019 06:41 AM
@nathand wrote:
@Gregory wrote:
So when do I want to use the swap values function?
Very rarely, and mostly when you want to actually swap two values. If you're leaving one output unwired, you probably don't need it.
This function is a relatively recent addition to LabVIEW to improve performance in a few unusual cases, for example I've seen sample code that uses it to implement recursive data structures (such as a linked list) efficiently.
in the following post,
ravensfan shows us how to use "swap values" and the IPE to implement the bubblesort algorithm
https://forums.ni.com/t5/LabVIEW/How-sort-array-without-using-Sort-1d-Array/m-p/3229658#M939147
this was also posted in 2015