Hi Fellows,
Say I have a 1000 x 1000 matrix, and I'm going to do some calculation in a
nested for-loop, with each pair of rows/cols in the matrix. But I suffered
a heavy performance penalty in row/col extraction. Here's my minimum
reproducible example, which I hope explains itself.
A = rand(0.:0.01:1.,1000,1000)
function test(x)
for i in 1:1000, j in 1:1000
x[:,i]
x[:,j]
end
end
test(A) # warm up
gc()
@time test(A)
## elapsed time: 13.28547939 seconds (16208000080 bytes allocated, 72.42%
gc time)
It takes 13 seconds, only extracting the rows/cols for the sake of further
calculations. I'm wondering if anything I could do to improve the
performance.Thanks in advance.
--
BEST REGARDS,
Todd Leo