[Rcpp-devel] R.e. First foray into Rcpp and comparison of speed with R
Christian Gunning
xian at unm.edu
Fri Sep 2 03:34:00 CEST 2011
On Thu, Sep 1, 2011 at 5:13 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
> Uh-oh. Factor 10. Wow.
Yeah, huh? To be fair, this example is ultra-contrived. The *only*
thing that happened was indexing.
Is it possible that compiler magic (ala loop unrolling that isn't done
for () ) accounts for any of the speedup? I have basically no
experience with this.
> Matrix is different because we cannot do [i, j] for C legacy reasons. So both
> variants may be fast...
Yeah, but we *can* do linear access of a matrix with something like [
i+nrow*j ], which shouldn't have any bound checking (right??). I
still don't see how linear bracket access on a matrix doesn't behave
the same as linear bracket access on vector compared to their
respective () behaviors...
-xian
--
A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
More information about the Rcpp-devel
mailing list