MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Very slow file writing.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg7769] [mg7769] Very slow file writing.
  • From: Alistair.Windsor at vuw.ac.nz (Alistair.Windsor at vuw.ac.nz)
  • Date: Tue, 8 Jul 1997 14:36:54 -0400
  • Organization: Victoria University of Wellington, New Zealand
  • Sender: owner-wri-mathgroup at wolfram.com

I recently had call to output a list of points in R^3, represented as
Lists of length 3, to a file writing the three numbers of a point on one
line separated by spaces (and then append a number). I used an elegant
method lifted almost without change from a package of Roman Maeder's

ndig = 5;
nForm[r_] := NumberForm[FortranForm[r], ndig];
CTDSFile=OpenWrite["RosslerBand.ctds",FormatType->OutputForm,PageWidth->
   Infinity];
writeVector[ r_List] /; Length[r] == 3 :=Write[CTDSFile, Infix[nForm /@
   r," "], " 0.05"];
Map[writeVector,PointList];
Close["RosslerBand.ctds"];

But this is unbelievably slow. Even when the list consisted of only 600
points the time to write the list was 337 seconds. This is very slow. I am
sure the very friendly but not very fast Macintosh HFS could be given some
of the blame but still this operation should be one of fractions of
seconds. I think it is the conversion to output form which makes this
unbelievably slow so could someone given me a more efficient if less
elegant solution. The Maeder POVray package uses the above form of output
and it too seems to be unreasonably slow. When writing non-trivial lists
this procedure can take half an hour or more.

The Maeder procedure is very elegant and allows very easy formatting of
the output but I would dispense with the ease for a (large) performance
gain.

-- 
Alistair Windsor


  • Prev by Date: Parametric Plot and Extracting Plot Points.
  • Next by Date: Checking for errors without messages.
  • Previous by thread: Parametric Plot and Extracting Plot Points.
  • Next by thread: Checking for errors without messages.