🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #1502

Query

#1502
From: Alan D Corre
Date: Tue, 14 Aug 1990 20:45
32 lines
1518 bytes
Altho I have been involved in programming for quite a while, my background
is humanistic, so please excuse this query if it displays a certain
ignorance.

I should like to know the following. If I am writing a program which
processes a long text, in terms of (1) program efficiency and (2) wear and
tear on disk drives, does it matter if I read a line from a disk file,
process it, and read it out to an output file, as opposed to reading a whole
bunch of lines into memory, processing them and then reading them out en
bloc to the output file. 
In other words, which is preferable:
(1)
while not end of input file do {
  read a line into a variable
  ...process the line...
  write the line to output file}
(2)
set up a list or array of, say, 100 elements
for 100 times
  read a line into the array
...process the array..
for 100 times
  write the array elements to output file

..or doesn't it make any difference?

Thank you.
--
Alan D. Corre
Department of Hebrew Studies
University of Wisconsin-Milwaukee                     (414) 229-4245
PO Box 413, Milwaukee, WI 53201               corre@csd4.csd.uwm.edu
Technical Details
Message-ID: <5754@uwm.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!csd4.csd.uwm.edu!corre

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!csd4.csd.uwm.edu!corre
From: corre@csd4.csd.uwm.edu (Alan D Corre)
Newsgroups: comp.lang.misc
Subject: Query
Message-ID: <5754@uwm.edu>
Date: 14 Aug 90 20:45:36 GMT
Sender: news@uwm.edu
Reply-To: corre@csd4.csd.uwm.edu (Alan D Corre)
Organization: University of Wisconsin-Milwaukee
Lines: 32