[Rcpp-devel] rcpp overhead

Dirk Eddelbuettel edd at debian.org
Sun Mar 11 17:56:26 CET 2012


On 11 March 2012 at 17:04, Kaveh Vakili wrote:
| 
| Dear Jared,
| 
| thank you on so many levels: 
| 
| A) you have understood my question (no, i'm not asking for free consulting,
| yes i'm comparing pur c++ and rcpp and yes this is the part of the code 
| that has the difference in timing --the rest of the code times roughtly 
| the same, no i'm not calling back anything from R and yes, i have no 
| experience in rcpp but 2* seems large to me for what is, after all, 
| a wraper)

You could use a profiler to get fine grained measures. You could even use the
same profiler for both candidate pieces.

Show reproducible example code if you want real help.

| B) I have matched the compiler options exactly (-O3 in both cases). 
| I have measured the execution times several times. They are large enough
|  6sec vec 29 sec), and the spreads increase with larger input sizes; 

So you're not doing the same thing. If time increases with larger load, you
are (seemingly) doing extra allocation etc on the slower part. Easy to have
an extra copy created etc..

You also need to separate between the core inner computing of a function, and
the call back and forth to R.  If you use, say, STL object and depending on
how you do things you may create extra copies.  That would be extra cost
vis-a-vis your bare version.  And you have to make sure you comparing the
right things.  You talked about measuring with system.time() from R and
measuring standalone code. There are obviously systematic differences.

There is no other overhead per se -- it is still C++ compilation. 
 
| C) you have not been obnoxious or disrespectfull. 

Careful. 

One more line like that and I may all of a sudden decide to kick you off the
mailing list. Usually doesn't help to annoy the admin.
 
| I have been experimenting with this most of yesterday. I can give more details of my experiments if someone is interrested. But i expect to get at least some help *understanding* what is wrong, not sneazy advices on how to read books inside dogs.

If you don't understand the difference between an email signature and an
email body I suspect you will have a lot other problems too.  Good luck to
you, I think you will need it.

Dirk

-- 
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx


More information about the Rcpp-devel mailing list