Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* http://stackoverflow.com/questions/8374056/is-it-safe-to-turn-off-patternpatv *)
- In[1]:= SetOptions[TimeAv, Method -> {"MinNum", 400000}, "BlockSize" -> 20000]
- Out[1]= {Method -> {"MinNum", 400000}, "ClearSystemCache" -> False,
- "BlockSize" -> 20000, "StoreAllTimings" -> False, "PrintStats" -> True}
- In[2]:= Clear[f]
- f[{x_, ___} | x__] := g[x]
- During evaluation of In[2]:= Pattern::patv: Name x used for both fixed and variable length patterns. >>
- During evaluation of In[2]:= Pattern::patv: Name x used for both fixed and variable length patterns. >>
- In[4]:= {f[{1, 2, 3}], f[1, 2, 3]} // TimeAv
- During evaluation of In[4]:= Total wall time is 2.580774, total cpu time is 2.37615 and total time spent evaluating the expression is 2.37615
- During evaluation of In[4]:= The expression was evaluated 400000 times, in blocks of 20000 runs. This yields a mean timing of 5.94037*10^-6 with a blocked standard deviation of 1.11362*10^-7.
- Out[4]= {5.94037*10^-6, {g[1], g[1, 2, 3]}}
- In[5]:= Clear[f]
- f[{x_, ___}] := g[x]
- f[x__] := g[x]
- In[8]:= {f[{1, 2, 3}], f[1, 2, 3]} // TimeAv
- During evaluation of In[8]:= Total wall time is 1.472172, total cpu time is 1.47209 and total time spent evaluating the expression is 1.47209
- During evaluation of In[8]:= The expression was evaluated 400000 times, in blocks of 20000 runs. This yields a mean timing of 3.68023*10^-6 with a blocked standard deviation of 9.79857*10^-8.
- Out[8]= {3.68023*10^-6, {g[1], g[1, 2, 3]}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement