Hi all,

I've followed with interest the development of the new evaluation API.
Now that it's finally merged, I was testing it. Perhaps I'm mistaken,
but shouldn't we expect a performance improvement in code such as the
following?

Rcpp::sourceCpp(code='
  #include <Rcpp.h>
  using namespace Rcpp;

  // [[Rcpp::export]]
  void old_api(Function func, int n) {
    for (int i=0; i<n; i++) func();
  }'
)

Rcpp::sourceCpp(code='
  #define RCPP_PROTECTED_EVAL
  #include <Rcpp.h>
  using namespace Rcpp;

  // [[Rcpp::export]]
  void new_api(Function func, int n) {
    for (int i=0; i<n; i++) func();
  }'
)

func <- function() 1
system.time(old_api(func, 1e5))
system.time(new_api(func, 1e5))

Regards,
Iñaki
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to