search for: unwind_protect

Displaying 3 results from an estimated 3 matches for "unwind_protect".

2019 Jun 18
2
Fast way to call an R function from C++?
For reference, your benchmark using UNWIND_PROTECT: > system.time(test(testFunc, evn$x)) user system elapsed 0.331 0.000 0.331 > system.time(test(C_test1, testFunc, evn$x)) user system elapsed 2.029 0.000 2.036 > system.time(test(C_test2, expr, evn)) user system elapsed 2.307 0.000 2.313 > system.time(test...
2019 Jun 19
0
Fast way to call an R function from C++?
...worse than R in this special case despite there is a common belief that C++ code is the fast one... Anyway, thanks again for your suggestions and reference! Best, Jiefei On Tue, Jun 18, 2019 at 2:39 PM I?aki Ucar <iucar at fedoraproject.org> wrote: > For reference, your benchmark using UNWIND_PROTECT: > > > system.time(test(testFunc, evn$x)) > user system elapsed > 0.331 0.000 0.331 > > system.time(test(C_test1, testFunc, evn$x)) > user system elapsed > 2.029 0.000 2.036 > > system.time(test(C_test2, expr, evn)) > user system elapsed &...
2019 Jun 18
3
Fast way to call an R function from C++?
Hi, I'm looking for a most efficient way to call an R function from C++ in a package. I know there are two functions (`R_forceAndCall` and `Rf_eval`) that can do the "call" part, but both are slow compared to calling the same function in R. I also try to use Rcpp and it is the worse one. Here is my test code: C++ code: ``` // [[Rcpp::export]] SEXP C_test1(SEXP f, SEXP x) { SEXP