Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Slowdown

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53223] Re: Slowdown
  • From: Peter Pein <petsie at arcor.de>
  • Date: Sat, 1 Jan 2005 02:33:43 -0500 (EST)
  • References: <cr33tt$je6$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Maxim wrote:
> Consider:
> 
> In[1]:=
> Module[{f, L},
>    L = f[];
>    Do[L = f[L, i], {i, 10^4}]
> ] // Timing
> 
> Module[{weirdness, L},
>    L = weirdness[];
>    Do[L = weirdness[L, i], {i, 10^4}]
> ] // Timing
> 
> Out[1]=
> {0.015*Second, Null}
> 
> Out[2]=
> {3.063*Second, Null}
> 
> Here the timings differ by a factor of 200. Besides, the timing grows  
> linearly in the first case and quadratically in the second (therefore, for  
> n=10^5 there will be an approximately 2000 times slowdown). We can only  
> guess that something goes wrong with the symbol name hashing.
> 
> Maxim Rytin
> m.r at inbox.ru
> 
Your version of Mathematica may be too up to date ;-)

In[1]:=
$Version
Out[1]=
"4.0 for Microsoft Windows (July 16, 1999)"
In[2]:=
Module[{f, L}, L = f[];
     Do[L = f[L, i], {i, 10^6}]] // Timing
Out[2]=
{1.547 Second, Null}
In[3]:=
Module[{weirdness, L}, L = weirdness[];
     Do[L = weirdness[L, i], {i, 10^6}]] // Timing
Out[3]=
{1.547 Second, Null}


-- 
Peter Pein
Berlin


  • Prev by Date: mathematica parser
  • Next by Date: Re: Re: Minors
  • Previous by thread: Re: mathematica parser
  • Next by thread: Re: Slowdown