21.3 Measuring performance, Profiling
Two options
profvis
. See 7.2 here https://csgillespie.github.io/efficientR/performance.html#lineprof
. See http://adv-r.had.co.nz/Profiling.html
Here are two examples using the above for
loop. First, we’ll use profvis
.
Code
Now we’ll use lineprof
.
Code
The output of profvis
seems to be more useful, at least for this example for
loop. The lineprof
has three separate entries for rnorm
and rbind
. Probably because this expects a function, not a for
loop.
Let’s see what microbenchmark
does.
Unit: nanoseconds
expr min lq mean median uq max neval
{ } 10 20 31.98 20 20 1042 100