Skip to content
Prev 9504 / 10988 Next

[Rcpp-devel] Timings for a program

Why is there a dot in ".*"? Are you perhaps thinking of Matlab?
On Fri, Jan 6, 2017 at 8:53 PM, Shaami <nzshaam at gmail.com> wrote:
For reference, there's very little benefit to removing loops in a
compiled language.  What Martyn said is exactly correct - it's your
responsibility to understand the difference between an interpreted
language like R and a compiled language like C++.

Some rules of thumb:
* In both R and C++, avoid unnecessary memory allocations.
* In R, minimize the number of distinct function calls.
  - A single function call: val = sum(1:10)
  - 10 function calls: val = 0; for (ii in 1:10) { val = val + ii}