- There are many global variables in
Gnew!. Non-constglobals inhibit type inference during compilation and hurt performance at runtime. I can’t say for sure, but it could very well be causing overhead that stretched the expected ~20 minutes to ~73 minutes. Even 1 non-constglobal can seriously hamper a method. The usual fix is to create method arguments and to pass the values to them in the function call. - You also didn’t post or describe the values for many global variables:
rickshift, rick0, shift, pd, dd, Tshift. - You don’t say what the arguments
Dandm_initinGnew!(D, m_init)are. - There are things in
Gnew!I can’t make sense of.- The argument
d(which the function call passesDto) isn’t used. -
mis commented as aTuple(nz,ny,nx,nT)of integers, which is fine. Butm[iz,iy,ix, :]is either multidimensional indexing or making aVectorwith typem, and neither of those things is consistent with the comment.
- The argument
1 Like