Now, let me prefix this by saying that I really enjoyed Radford’s posts. He obviously put a lot of time into finding a number of (all somewhat
small in isolation) inefficiencies in R which, when taken together, can make a difference in
performance. I already spotted one commit by Duncan in the SVN logs for R so this is being looked at.

Yet Christian, on the other hand, goes a little overboard in bemoaning performance differences somewhere between ten and fifteen percent — the
difference between curly and straight braces (as noticed in Radford’s first post). Maybe he spent too much time waiting for his MCMC runs to
finish to realize the obvious: compiled code is evidently much faster.

And before everybody goes and moans and groans that that is hard, allow me to just interject and note that it is not. It really
doesn’t have to be. Here is a quick
cleaned up version of Christian’s example code, with proper assigment operators and a second variable x. We then get to the
meat and potatoes and load ourRcpp package as well asinline to define the same little test function in C++. Throw inrbenchmark which I am becoming increasingly fond of for these little timing tests,et voila, we have ourselves a horserace:

So do we really want to spend time arguing about the ten and fifteen percent differences? Moore’s law gets you
those gains in a couple of weeks anyway. I’d much rather have a conversation about how we can get people speed increases that are orders of
magnitude, not fractions. Rcpp is one such tool. Let’s get more of them.