MathGroup Archive 2003

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

Search the Archive

Re: Curious Timing Results

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38663] Re: Curious Timing Results
  • From: Bill Rowe <listuser at earthlink.net>
  • Date: Sat, 4 Jan 2003 07:25:43 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 1/3/03 at 12:15 AM, grant at math.byu.edu (Chris Grant) wrote:

>I find the Timing results below a little curious.  Is there a simple
>explanation why I shouldn't?

>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

Huh??? The last element of y should be 1000000 while the last element of x should be 2.

>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.}

Possibly the difference is because one is stored as a packed array and the other isn't.

try Developer`PackedArrayQ[x] and Developer`PackedArrayQ[y]


  • Prev by Date: Re: Curious Timing Results
  • Next by Date: tabular output
  • Previous by thread: Re: Curious Timing Results
  • Next by thread: Re: Curious Timing Results