Slowdown
- To: mathgroup at smc.vnet.net
- Subject: [mg53220] Slowdown
- From: Maxim <ab_def at prontomail.com>
- Date: Fri, 31 Dec 2004 03:47:44 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
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