Arrays and lists

In the timing program above, there is no i/o. The elements are just given by the integer values from the do-loop. While this is a good way to compare the overhead effort associated with the various approaches, it takes it out of the original context, which was reading an array of unknown length. That formatted i/o, reading one integer at a time, is typically larger than anything related to either the node allocation of a linked-list or of copying the contents of short arrays into longer arrays.

As mentioned previously, the best approach would be to change the fortran standard so that arrays of unknown length can be read directly into the target allocatable array. This eliminates all the overhead associated with the user-defined-type allocations, and overall it eliminates a memory-to-memory copy of each array element. Internally, the fortran library is already doing the effort by transferring the data from the external file or device into its i/o buffers, and then from there into the integer variable. The user-written linked list code we are talking about now is just duplicating that effort again.