Fw: Re: Curious Timing Results
- To: mathgroup at smc.vnet.net
- Subject: [mg38743] Fw: [mg38666] Re: [mg38651] Curious Timing Results
- From: 최정규 <cjk2807 at pslab.snu.ac.kr>
- Date: Tue, 7 Jan 2003 07:32:08 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Dear Andrzej Kozlowski At first, I am so grateful to your reply which helped me with some stuffs. Anyway, tracing the inputs, I found something strange to me. That is, I've got "In[3]:= SameQ[x,y] -> Out[3]= False" , not "In[3]:= SameQ[x,y] -> Out[3]= True" I can't understand it. Jungkyu Choi Seoul, South-Korea. e-mail: cjk2807 at hotmail.com ----- Original Message ----- From: "Andrzej Kozlowski" <akoz at mimuw.edu.pl> To: mathgroup at smc.vnet.net Subject: [mg38743] [mg38666] Re: [mg38651] Curious Timing Results > You can see the difference as follows: > > In[17]:= > <<Developer` > > In[18]:= > x = Table[2.,{i,100000}]; > > In[19]:= > PackedArrayQ[x] > > Out[19]= > True > > In[20]:= > y = Table[If[i<1000000,2.,i],{i,100000}]; > > In[21]:= > PackedArrayQ[y] > > Out[21]= > False > > THe need to unpack a packed array makes the first code run slower. > > > Andrzej Kozlowski > Yokohama, Japan > http://www.mimuw.edu.pl/~akoz/ > http://platon.c.u-tokyo.ac.jp/andrzej/ > > > > > On Friday, January 3, 2003, at 02:15 PM, Chris Grant wrote: > > > > > I find the Timing results below a little curious. Is there a simple > > explanation why I shouldn't? > > > > Chris Grant > > > > In[1]:= x = Table[2.,{i,100000}]; > > > > In[2]:= y = Table[If[i<1000000,2.,i],{i,100000}]; > > > > In[3]:= SameQ[x,y] > > > > Out[3]= True > > > > In[4]:= Timing[Inner[Divide,x,x]] > > > > Out[4]= {0.44 Second,100000.} > > > > In[5]:= Timing[Inner[Divide,y,y]] > > > > Out[5]= {0.321 Second,100000.} > > > > > > >