Skip to content
Back to formatted view

Raw Message

Message-ID: <19966.16576.798684.673996@max.nulle.part>
Date: 2011-06-19T18:32:32Z
From: Dirk Eddelbuettel
Subject: [Rcpp-devel] Short blog post on loop speed in R
In-Reply-To: <BANLkTi=Fz52bWiYcYdthScKD+=qs7uH0dA@mail.gmail.com>

On 19 June 2011 at 13:20, Douglas Bates wrote:
| Interesting post, Christian.  It turns out that the apply family can
| get better performance than the explicit loop but, as you have seen,
| no using aaply.  The choices in this case are sapply or, slightly
| faster, vapply from the base package.  I also tried using cmpfun from
| the compiler package but vapply is already very tight so  compiling
| that call doesn't change the timing.
| 
| As for the use of Rcpp, the STL containers and algorithms can be
| exploited to an even greater extent.  If you are willing to jump
| through the hoops of defining a struct that inherits from
| std::binary_function then you can shorten the Rcpp-based code
| considerably.  See the enclosed.

Now we're talking!  Very nice post by Christian, and and a very impressive
follow-up by Doug. Keep it coming, guys

Dirk

-- 
Gauss once played himself in a zero-sum game and won $50.
                      -- #11 at http://www.gaussfacts.com