Re: [Rcpp-devel] Loops, iterators and accumulate

2012-11-15 Thread Dirk Eddelbuettel
On 15 November 2012 at 07:49, Hadley Wickham wrote: | I didn't, but I'm looking at it now, thanks. The main problem is that | many of the examples use C++ idioms I don't understand - and as I That is *the whole point* -- C++, not unlike R, is a version of nethack: Enter the dungeon, and find the

Re: [Rcpp-devel] Loops, iterators and accumulate

2012-11-15 Thread Smith, Dale
Mail: dale.sm...@fiserv.com www.fiserv.com -Original Message- From: rcpp-devel-boun...@r-forge.wu-wien.ac.at [mailto:rcpp-devel-boun...@r-forge.wu-wien.ac.at] On Behalf Of Romain Francois Sent: Thursday, November 15, 2012 9:18 AM To: Hadley Wickham Cc: rcpp-devel Subject: Re: [Rcpp-devel] Lo

Re: [Rcpp-devel] Loops, iterators and accumulate

2012-11-15 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Just to add one more test here: Unit: microseconds exprmin lq median uq max 1 sum1(x) 19.835 20.0445 20.184 20.3585 43.651 2 sum2a(x) 19.835 20.0095 20.184 20.3240 48.958 3 sum2(x) 93.797 94.0760 94.146 94.4250 204.355 4 s

Re: [Rcpp-devel] Loops, iterators and accumulate

2012-11-15 Thread Romain Francois
Le 15/11/12 15:14, Hadley Wickham a écrit : On Thu, Nov 15, 2012 at 8:11 AM, Romain Francois wrote: I'm not getting the same results, so I might not make the same conclusions: Unit: microseconds exprmin lq median uqmax 1 sum(x) 16.072 16.161 16.2090 16.3110 21.721 2

Re: [Rcpp-devel] Loops, iterators and accumulate

2012-11-15 Thread Hadley Wickham
On Thu, Nov 15, 2012 at 8:11 AM, Romain Francois wrote: > I'm not getting the same results, so I might not make the same conclusions: > > > Unit: microseconds > exprmin lq median uqmax > 1 sum(x) 16.072 16.161 16.2090 16.3110 21.721 > 2 sum1(x) 10.771 10.954 11.0445 11.1

Re: [Rcpp-devel] Loops, iterators and accumulate

2012-11-15 Thread Romain Francois
I'm not getting the same results, so I might not make the same conclusions: Unit: microseconds exprmin lq median uqmax 1 sum(x) 16.072 16.161 16.2090 16.3110 21.721 2 sum1(x) 10.771 10.954 11.0445 11.1910 16.163 3 sum2(x) 48.438 48.567 48.6650 48.8425 61.116 4 sum2a(x)

Re: [Rcpp-devel] Loops, iterators and accumulate

2012-11-15 Thread Hadley Wickham
> | I'm trying to get a better handle on writing efficient numerical code > | with C++. I've attached five implementations of a simple sum function > | (mostly ignoring NAs) and timed them below: > > Did you see the (fairly extensive) comparison in > examples/ConvolveBenchmarks/ > which comp

Re: [Rcpp-devel] Loops, iterators and accumulate

2012-11-15 Thread Dirk Eddelbuettel
On 15 November 2012 at 07:24, Hadley Wickham wrote: | Hi all, | | I'm trying to get a better handle on writing efficient numerical code | with C++. I've attached five implementations of a simple sum function | (mostly ignoring NAs) and timed them below: Did you see the (fairly extensive) compar

[Rcpp-devel] Loops, iterators and accumulate

2012-11-15 Thread Hadley Wickham
Hi all, I'm trying to get a better handle on writing efficient numerical code with C++. I've attached five implementations of a simple sum function (mostly ignoring NAs) and timed them below: > source("sum.r") Unit: microseconds expr minlq medianuq max neval sum(x) 11.67 11.72