Tell me more ×  Is there a good way to profile code in
Mathematica? I would like to be able to recurse (i.e., if I say
f[a_] := b[a], then Profile[f[1]] should give almost the same
output as Profile[b[1]]), but I'll settle for being able to do
something like applying Timing to every relevant subexpression.
It would be nice if I didn't have to special-case things like
Module, but I'd like, e.g., Profile[Module[{x=1+2},x!]] to give
me an output like  Time    Expression         Result 0       1
1 0       2                  2 0       1 + 2              3 0
x$1234             3    0       x$1234 !           6 0
Module[{x=1+2},x!] 6  share|improve this question Related:… – 
yoda Nov 11 '11 at 1:53 Also see:… –  Mr.Wizard Nov 11 '11 at
5:23 All: I am trying to do this with TraceScan but I am running
into the problem that Mathematica caches results, therefore
sequential calls to Prime[13!] for example take greatly
different times to evaluate. –  Mr.Wizard Nov 11 '11 at 5:42 add
comment  3