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: [mg53261] Re: Slowdown
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Mon, 3 Jan 2005 04:29:38 -0500 (EST)
  • References: <cr33tt$je6$1@smc.vnet.net> <cr8ekc$r8r$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Roland Franzius wrote:
> 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.
> 
> 
> The timing difference occurs when the symbol "wierdness" exceeds 8 
> characters. Test it for "wierdnes". That seems to be a consequence of 
> the machine routine for string comparison. Up to 8 characters can be 
> used without using a memory to memory compare. Of course it should be 
> possible to write a compare routine that makes not such a bit step.
> 
In fact almost all symbols (of whatever length) are not weird! I am sure 
Mathematica manipulates symbols as pointers - so their length should 
only be relevant to performance for a few operations, such as input/output.

David Bailey
dbaileyconsultancy.co.uk


  • Prev by Date: Strange bug
  • Next by Date: Re: Thread
  • Previous by thread: Re: Slowdown
  • Next by thread: Re: Re: Minors