Re: Speed of writing in Mathematica 3.01
- To: mathgroup@smc.vnet.net
- Subject: [mg11770] Re: Speed of writing in Mathematica 3.01
- From: Rolf Mertig <rolf@mertig.com>
- Date: Sat, 28 Mar 1998 00:25:10 -0500
- Organization: Mertig Research & Consulting
- References: <6fd5ag$6aq@smc.vnet.net>
You are doing nothing wrong (except maybe not running Linux on your Mac). On my a antique 25 Mhz NeXTStation (1991), running the (unfortunately) very last official release of Mathematica for NeXTStep (if there are more people, like me, who would actually *pay* for the next version of Mathematica for NeXTStep, then speak up to WRI, please!), and a simple Linux-Box (Pentium 120 MHz): In[1]:= $Version Out[1]= NeXT 3.0 (April 15, 1997) In[2]:= a = Table[i,{i,1001}]; In[3]:= Timing[ filename="test.ascii"; output=OpenWrite[filename]; Do[Write[output,a[[i]]];,{i,1,1001}]; Close[output];] Out[3]= {1.46824 Second, Null} In[1]:= $Version Out[1]= Linux 3.0 (April 25, 1997) In[2]:= a = Table[i,{i,1001}]; In[3]:= Timing[ filename="test.ascii"; output=OpenWrite[filename]; Do[Write[output,a[[i]]];,{i,1,1001}]; Close[output];] Out[3]= {0.33 Second, Null} Rolf Mertig Mathematica programming, training & consulting http://www.mertig.com James Bridges wrote: > Am I doing something wrong or is it supposed to take orders of magnitude > longer than is reasonable to write out a simple ASCII file from > Mathematica? Consider this simple test: > > In[7]:= > a=Table [i,{i,1,1001}]; > > In[8]:= > Timing[ > filename="Macintosh HD:test.ascii"; > output=OpenWrite[filename]; > Do[ > Write[output,a[[i]]]; > ,{i,1,1001}]; > Close[output]; > ] > > Out[8]= > {23.4 Second,Null} > > 23 seconds to write 1001 integers?! On a 233MHz G3! Everything else is > whiff-bam fast, but writing is glacial. Now this is a simplified > example of what I need to do but it contains one of the factors, namely > that I have to individually write out elements of a list, hence the Do > loop. Any hints? > > James Bridges > > -- > James Bridges > Cleveland, OH