• API
• FAQ
• Tools
• Trends
• Archive
SHARE
TWEET

# SO/8374056

simonjtyler Dec 4th, 2011 31 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. (* http://stackoverflow.com/questions/8374056/is-it-safe-to-turn-off-patternpatv *)
2.
3. In[1]:= SetOptions[TimeAv, Method -> {"MinNum", 400000}, "BlockSize" -> 20000]
4.
5. Out[1]= {Method -> {"MinNum", 400000}, "ClearSystemCache" -> False,
6.  "BlockSize" -> 20000, "StoreAllTimings" -> False, "PrintStats" -> True}
7.
8. In[2]:= Clear[f]
9.         f[{x_, ___} | x__] := g[x]
10.
11. During evaluation of In[2]:= Pattern::patv: Name x used for both fixed and variable length patterns. >>
12.
13. During evaluation of In[2]:= Pattern::patv: Name x used for both fixed and variable length patterns. >>
14.
15. In[4]:= {f[{1, 2, 3}], f[1, 2, 3]} // TimeAv
16.
17. 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
18.
19. 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.
20.
21. Out[4]= {5.94037*10^-6, {g[1], g[1, 2, 3]}}
22.
23. In[5]:= Clear[f]
24.         f[{x_, ___}] := g[x]
25.         f[x__] := g[x]
26.
27. In[8]:= {f[{1, 2, 3}], f[1, 2, 3]} // TimeAv
28.
29. 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
30.
31. 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.
32.
33. Out[8]= {3.68023*10^-6, {g[1], g[1, 2, 3]}}
RAW Paste Data
Top