...
- Allocate dynamic arrays only at a high level and infrequently
- use stack arrays or for all subroutine array temporaries
- understand the size of these arrays in order to have a good estimate of the needed stacksize
- See below for similar problems with array slicing causing similar problemshidden allocation & array copies
Array Slicing
In my opinion, there are very few cases when array slicing is wise to do. I know it's a convenient feature of Fortran, but it's the cause of some of our worst performance degradations. The only time I think array slicing is OK is when you're moving a contiguous chunk of data, not computing things. For instance:
...