02-28-2011 01:27 AM
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
02-28-2011 01:58 AM
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
02-28-2011 06:03 AM - edited 02-28-2011 06:03 AM
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.
02-28-2011 06:22 AM
I think for developement reason it's better to use a while loop, cause it's more flexible.
Regards,
Bjorn