[comp.lang.fortran] slow write - explanation

h3dy@vax5.cit.cornell.edu (03/23/90)

Many people responded to my slow implied-do i/o problem.

               -Thank you- 

If it is a problem on your compiler/machine to do:

      write (unit) (array(i),i=1,n)

then the overwhelming consensus is to pass the array name
and n to a subroutine which does:

      subroutine ouput (array,n)
      dimension array(n)

      write (unit) array

People were surprised that the implied do was so slow.  (I
am using Vax Fortran 5.2.)  I discovered (oops!) that I was
compiling /check, which checks for array out-of-bounds,
explaining the huge time difference between the block write
and the implied-do write.

So, if you need to have array bounds checking, you may
need to use a separate subroutine to output large arrays
of run-time determined size.

Sincere thanks to everyone who responded.