r - lineprof equivalent for Rcpp -
the lineprof
package in r useful profiling parts of function take time , allocate/free memory.
is there lineprof()
equivalent rcpp ?
i use std::chrono::steady_clock
, such chunk timings out of rcpp
function. alternatives? rstudio ide
provide here?
to supplement @dirk's answer...
if working on os x, time profiler instrument, part of apple's instruments set of instrumentation tools, excellent sampling profiler.
just fix ideas:
a sampling profiler lets answer question, what code paths program spend time executing?
a (full) cache profiler lets answer question, which executed code paths in program?
these different questions -- it's possible hottest code paths optimized enough that, though total number of instructions executed in path high, amount of time required execute them might relatively low.
if want use instruments profile c++ code / routines used in r package, easiest way go is:
- create target, pointed @ r executable, appropriate command line arguments run whatever functions wish profile:
- set command line arguments run code exercise c++ routines -- example, code runs
rcpp:::test()
, instrument ofrcpp
test code:
- click big red record button, , off go!
i'll leave rest of instructions in understanding instruments + timing profiler google-fu + documentation, (if you're on os x) should aware of tool.
Comments
Post a Comment