MathGroup Archive 1999

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

Search the Archive

Re: ReadList Problems

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16727] Re: [mg16639] ReadList Problems
  • From: "Tomas Garza" <tgarza at mail.internet.com.mx>
  • Date: Wed, 24 Mar 1999 02:23:45 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Reinhard Alt wrote:

> i am trying to use ReadList["file.dat",Number,RecordLists -> True]
> The typ of file.dat is an ASCII file matrix (328 columns, 246 rows),
> size 800 kB.
> I need to read 5 such files but the evaluation time is about 90 minutes.
> After saving the session, the notebook size is about 50 MB. Whats wrong?
> (Computer RAM 64 MB)
> Is it possible speed up this prozess.

Hello, Reinhard:

I generate a table of 246 by 328 in less than 2 sec:

In[1]:=
Timing[a=Table[Table[Random[Integer,{1,100}],{328}],{246}];]
Out[1]=
{1.7 Second,Null}

I save it in ASCII form using a standard procedure which is widely
available. This takes little more than 8 sec, and the resulting ASCII file
has a size of 231 Kb :

In[2]:=
Timing[WriteMatrix["c:\Mathgroup\Tomas",a];]
Out[2]=
{8.13 Second,Null}

I read it back into Mathematica in half a second:

In[3]:=
Timing[b=ReadList["c:\Mathgroup\Tomas",Number,RecordLists->True];]
Out[3]=
{0.5 Second,Null}

I save it as a Mathematica file in less than 3 seconds:

In[4]:=
b>>"c:\Mathgroup\Tomas";//Timing
Out[4]=
{2.74 Second,Null}

and the Mathematica file has a size of 331 Kb. Even conceding that I am
using a fast machine (400 MHz with 128 Mb Ram under Windows 95), I think
that 90 minutes for reading 5 such files is really too much to accomplish
what I could do in less than 3 sec. And of course the size of the resulting
files is excessive, too. You have to take a close look at your machine, and
examine, step by step, what is going on.

Tomas Garza
Mexico City



  • Prev by Date: RE: Programmed PageBreaks
  • Next by Date: Re: combining two plots
  • Previous by thread: Re: ReadList Problems
  • Next by thread: Thanks (was: Gettting Rid of units)