Using 2d array vs array of derived type in Fortran 90
问题 Assuming you want a list of arrays, each having the same size. Is it better performance-wise to use a 2D array : integer, allocatable :: data(:,:) or an array of derived types : type test integer, allocatable :: content(:) end type type(test), allocatable :: data(:) Of course, for arrays of different sizes, we don't have a choice. But how is the memory managed between the 2 cases ? Also, is one of them good code practice ? 回答1: In general, you want to use the simplest data structure that