09-25-2012 12:12 PM - edited 09-25-2012 12:14 PM
Right you are! It's shift registers that, when their size increases with each iteration of a loop, are not very efficient and are better replaced by the initialize array / replace subsets combo. It takes a couple of times for things to stick in memory sometimes, but I'm getting there!
Edit: By you specifying FOR loops in your answer, am I correct in thinking that other types of loop (where there isn't a pre-defined execution number) do not benefit from the same autoindexing efficiency?
09-25-2012 12:41 PM
J.Mamakos wrote:
Edit: By you specifying FOR loops in your answer, am I correct in thinking that other types of loop (where there isn't a pre-defined execution number) do not benefit from the same autoindexing efficiency?
That's right. If I'm not mistaken, an auto-indexing while loop is more efficient than build array in a loop, but less efficient than a for loop. My understanding is that the while loop uses an algorithm that increases (doubles, maybe?) the size of the array each time it fills, then resizes the array to the appropriate length when the loop exits.
09-25-2012 12:46 PM
@J.Mamakos wrote:
Edit: By you specifying FOR loops in your answer, am I correct in thinking that other types of loop (where there isn't a pre-defined execution number) do not benefit from the same autoindexing efficiency?
That is correct. The while loop does not have the same memory luxuries as the FOR loop.