#!/usr/bin/r library(inline) library(rbenchmark) serialCode <- ' // assign to C++ vector std::vector x = Rcpp::as >(xs); size_t n = x.size(); for (size_t i=0; i x = Rcpp::as >(xs); std::transform(x.begin(), x.end(), x.begin(), ::log); return Rcpp::wrap(x); ' funSerialStdAlg <- cxxfunction(signature(xs="numeric"), body=serialStdAlgCode, plugin="Rcpp") ## same, but with Rcpp vector just to see if there is measurable difference serialRcppCode <- ' // assign to C++ vector Rcpp::NumericVector x = Rcpp::NumericVector(xs); size_t n = x.size(); for (size_t i=0; i x = Rcpp::as >(xs); size_t n = x.size(); #pragma omp parallel for shared(x, n) for (size_t i=0; i