Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!sci.ccny.cuny.edu!phri!cmcl2!acf4!mcqueen From: mcqueen@acf4.NYU.EDU (David M. McQueen) Newsgroups: comp.lang.fortran Subject: Re: slow write Message-ID: <13160005@acf4.NYU.EDU> Date: 22 Mar 90 20:30:00 GMT References: <3673.2607e3bb@vax5.cit.cornell.edu> Organization: New York University Lines: 42 /* acf4:comp.lang.fortran / h3dy@vax5.cit.cornell.edu / 7:27 pm Mar 21, 1990 */ > I have a large array (characters) that I read in, process, > then write out to a file. Prior to run time, I dont know > the final number of elements - it is smaller than the original. > > write (10) array > > is fast, but if the array is much smaller, I don't want to > do this. > > write (10) (array(i),i=1,n) > > but an implied do is very very slow! How can I get the > combine the advantages whilst avoiding the disadvantages? > My array is about 15000000 characters long initially. > > I am embarrassed to say I tried equivalencing arrays of > different sizes, using the closest one. Ugliness. > > Thanks for the help, sorry if this appears 2x, pnews is "broken" > so I am using anunews. /* ---------- */ How about this: program main dimension array(large) . . . call out(array,ismall) . . . subroutine out(array,ismall) dimension array(ismall) write(10) array return end You might want to also write out the value of ismall for the benefit of the program which reads the file.