LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Functional Global - While/For Loop

Hi Ppl,

 

I recently came across a functional global implemented with a for loop wired with a 1 to the count terminal. I have been moslty using the while loop wired with a TRUE, and some times using the Feed back nodes for implementing the functional globals. Are there any performance improvements for functiosnla globals while using For Loops ?

 

Thanks,

Sathish

0 Kudos
Message 1 of 4
(2,953 Views)

It's a matter of taste. It shouldn't be any difference in performance. When writing text based programs i much prefer for-loops to while. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 4
(2,944 Views)

I remember reading (I can't find the link) that a for loop is slightly more efficient than a while loop for a FGV, because the compiler knows the for loop termination criteria before it runs, and so is able to reserve any resources which may be required. As opposed to a while loop which evaluates its termination after the loop has run each iteration, and needs to request resources on the fly.

 

Although I was always under the impresion that a for loop gets converted to a while loop by the pre-comp.

_____________________________
- Cheers, Ed
0 Kudos
Message 3 of 4
(2,925 Views)

I think for developement reason it's better to use a while loop, cause it's more flexible.

 

Regards,

 

Bjorn

Kind regards,

- Bjorn -

Have fun using LabVIEW... and if you like my answer, please pay me back in Kudo's 😉
LabVIEW 5.1 - LabVIEW 2012
0 Kudos
Message 4 of 4
(2,909 Views)