[Rcpp-devel] Rcpp speed

Gabor Grothendieck ggrothendieck at gmail.com
Tue Dec 21 15:51:15 CET 2010


On Tue, Dec 21, 2010 at 9:39 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> On 21 December 2010 at 09:15, Gabor Grothendieck wrote:
> | Can anyone explain these results?   Rcpp takes 30% more time than R
> | with 10 elements, the same time as R with 1000 elements and 7x as long
> | with a million elements.  I would have expected the ratio to be
> | highest for `10 elements since that would be dominated by the call
> | sequence but its the other way around and it seems to get relatively
> | less efficient as the size of the vector grows.
>
> Errr, these are _single expressions in the R parser_ !  So how could they be
> faster in Rcpp when we have to do the extra marshalling of objects on the
> heap, NA tests, exception handlings, etc pp ?  Did you seriously thing there
> could be a gain?
>
> If you have a real task, time that.
>
> Do you recall the issue started by Radford Neal about curly or straight
> paranthese?  When Christian Robert followed up and that whole thing became a
> little blogging storm, I wrote an ad-hoc post ... demonstrating an 80-fold
> speed increase with Rcpp.  That was in September, and be we may well have got
> faster since as a number of tweaks went into Rcpp.
>
> In any event, the aforementioned blog post is
>
> http://dirk.eddelbuettel.com/blog/2010/09/07#straight_curly_or_compiled
>
> Otherwise, thanks for being empirical and posting replicable code using
> inline and rbenchmark. That is the right idea. But I fear you started to
> measure the wrong question here.

My question was not why Rcpp was slower.
Also posted link does not use sugar.

My question was why the relative speed did not improve as the size
increased but instead got worse.  Does using sugar mean that it just
gets me back to the speed of R or worse?








-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com


More information about the Rcpp-devel mailing list