[Rcpp-devel] Rf_ReplIteration and profiling output from google perftools

Ramon Diaz-Uriarte rdiaz02 at gmail.com
Mon Mar 18 13:11:27 CET 2013


Dear All,

I am using google perftools to profile C++ called with Rcpp (following the
very neat blog http://pj.freefaculty.org/blog/?p=140 by Paul E. Johnson). 

This is an example of the output I get from the google perftools (after
sorting the output), when I focus on function "Algorithm5M" (the one
called from R).

   12025   7.0%  83.5%    12028   7.0% __copy_m (inline)
    9283   5.4%  95.6%    13687   8.0% std::vector::size (inline)
   78442  45.8%  45.8%    82709  48.2% std::vector::operator[] (inline)
       0   0.0% 100.0%   152024  88.7% Rf_ReplIteration
       0   0.0% 100.0%   171437 100.0% bcEval
       0   0.0% 100.0%   171437 100.0% do_begin
       0   0.0% 100.0%   171437 100.0% do_dotcall
       0   0.0% 100.0%   171437 100.0% do_eval
       0   0.0% 100.0%   171437 100.0% do_set
       0   0.0% 100.0%   171437 100.0% do_subset
       0   0.0% 100.0%   171437 100.0% forcePromise
       0   0.0% 100.0%   171437 100.0% FORCE_PROMISE (inline)
       0   0.0% 100.0%   171437 100.0% getvar (inline)
       0   0.0% 100.0%   171437 100.0% Rf_applyClosure
       0   0.0% 100.0%   171437 100.0% Rf_DispatchOrEval
       0   0.0% 100.0%   171437 100.0% Rf_eval
   52626  30.7%  76.5%   171437 100.0% Algorithm5M


I guess that things such as Rf_eval, Rf_applyClosure, etc, should show in
100% of the profiling samples (the 5th column). In other words, in terms
of improving my code, I can forget about all those 100% lines. However, I
was surprised by Rf_ReplIteration. I was expecting it to either show up in
100% of the samples, or show up in a lot fewer.

Am I doing something silly when using Rcpp and calling my function (i.e.,
that 87% reflects that I could be using it more efficiently), or is this
something I should expect (I am happy to provide full examples, etc, but I
didn't want to fill up the list with unnecessary stuff, especially since I
think my confusion is due to my not understanding something about
Rf_ReplIteration).


Best,


R.




-- 
Ramon Diaz-Uriarte
Department of Biochemistry, Lab B-25
Facultad de Medicina 
Universidad Autónoma de Madrid 
Arzobispo Morcillo, 4
28029 Madrid
Spain

Phone: +34-91-497-2412

Email: rdiaz02 at gmail.com
       ramon.diaz at iib.uam.es

http://ligarto.org/rdiaz




More information about the Rcpp-devel mailing list