home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,588 of 2,978   
   Bart to All   
   Re: slow writing of text files   
   11 May 05 18:38:02   
   
   From: broersma.juda_ANTISPAM_@tiscali.nl   
      
   Op Wed, 11 May 2005 12:37:59 -0000 schreef "Floris"   
   :   
      
   >Hello all,   
   >   
   >I'm using freepascal to write text files, but it writes really slow.   
   >It looks something like this and it writes with about 300 KB per second:   
   >   
   >for i:=1 to 1000 do begin   
   >  outfilename:='myname' + integertostring(i) +'.txt';   
   >  Assign (outfile,outfilename);   
   >  rewrite(outfile);   
   >   
   >  for j:=1 to 16000 do begin   
   >    for k:=1 to 4 do begin   
   >      write (outfile,myarray[i][j][k]:2:2,',');   
   >    end;   
   >    writeln (outfile);   
   >  end;   
   >end;   
   >   
   >close (outfile);   
      
      
   >If I replace myarray[i][j][k] with a constant string I get write speed of   
   >about 20 MB.   
      
   Well if you replace 64 million (1000*4*16000) occurences of   
   calculating the memoryposition of myarray[i][j][k] (in order to be   
   able to access the right data in the array) with code that does not   
   require such calculations, I think this will speed up things   
   dramatically ...   
      
   >Is there a way of speeding up the write process?   
      
   Do calculations on what to write (a huge string?, don't know what type   
   myarray is though) in memory and then write only once to file perhaps   
   ...   
      
   >Writing to a binary file is much faster but not an option at the moment.   
   Why is a binary file not an option at the moment ?   
      
   >Floris   
      
      
   Bart   
   --   
   Bart Broersma   
   broersma.juda_ANTISPAM_@tiscali.nl   
   (ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca