-
-
Notifications
You must be signed in to change notification settings - Fork 219
Closed
Description
This has been discussed on the Rcpp mailing list: http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2018-June/010029.html
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
Metadata
Metadata
Assignees
Labels
No labels