26 September 2019 2 2K Report

why it is better to implement the same algorithm but without loops?

Example:

If I have an array of values, I want to substitute them in a specific equation.

I can do that by 2 ways:

1) loop for each value of array.

2) I can write all the arrays manually (if the size of array is small) under each other then write the mentioned equation then run the program for calculation.

SO why it is better to avoid 1) and follow 2)

Does the loop have a bad effect on controllers ?? does they cause additional lag than manual technique ?

I kept thinking about that, I noticed that there are always a difference in performance but I do't know why. 2 is always better than 1 !!

More Akram el's questions See All
Similar questions and discussions