So I have a piece of code with 4 Float arrays (let's call them temp, arr1,
arr2, arr3), and this is basically what happens:
for i in [1:1000]
# Some code that modifies the entries of temp.
arr1 = 2*arr2 - arr3 + constants*temp
arr3 = arr2
arr2 = arr1
end
As it turns out, the #Some code that... step is actually only 1/3 of the
execution time, i.e., the majority of the execution time is in the 3 lines
which juggle arr1, arr2 and arr3. Using the @time macro also shows that
most of the memory allocation and garbage collection is occurring in those
3 steps.
What, if anything, is the best way to minimize memory allocation time in
such a situation?