Re: RE: puzzling difference in speed
- To: mathgroup at smc.vnet.net
- Subject: [mg34795] Re: [mg34737] RE: [mg34688] puzzling difference in speed
- From: "Fred Simons" <f.h.simons at tue.nl>
- Date: Fri, 7 Jun 2002 01:08:58 -0400 (EDT)
- References: <200206040741.DAA03886@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hartmut Wolf remarked with respect to the given examples::
> Obviously the computing machinery for Array behaves differently when the
> dimensions are given explicitly or introduced as an expression (to be
> evaluated)
>
It seems to be more complicated. Have a look at the following results:
In[1]:=
n=100; t1 = Table[0, {n},{n},{n}];
In[2]:=
t = array[Plus, Dimensions[t1]];
u = array[Plus, {100, 100, 100}];
Equal[t, u]
Out[4]= True
In[5]:=
ReplaceAll[t, array\[Rule]Array]; // Timing
ReplaceAll[u ,array\[Rule]Array]; // Timing
Out[5]=
{0.65 Second,Null}
Out[6]=
{0.77 Second,Null}
In[7]:=
Apply[Array, t]; // Timing
Apply[Array, u]; // Timing
Out[7]=
{4.51 Second,Null}
Out[8]=
{0.72 Second,Null}
Despite the fact that t equals u, we have the same difference in timing.
Does Mathematica 'remember' the way the expression t has been computed?
Fred Simons
Eindhoven University of Technology
- References:
- RE: puzzling difference in speed
- From: "Wolf, Hartmut" <Hartmut.Wolf@t-systems.com>
- RE: puzzling difference in speed