Displaying 4 results from an estimated 4 matches for "r_forceandcall".
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 call =PROTECT(Rf_lang2(f, x));
SEXP val =...
2019 Jun 18
2
Fast way to call an R function from C++?
...0:35, I?aki Ucar <iucar at fedoraproject.org> wrote:
>
> On Tue, 18 Jun 2019 at 19:41, King Jiefei <szwjf08 at gmail.com> wrote:
> >
> > [...]
> >
> > It is clear to see that calling an R function in R is the fast one, it is
> > about 5X faster than ` R_forceAndCall ` and ` Rf_eval`. the latter two
> > functions have a similar performance and using Rcpp is the worst one. Is it
> > expected? Why is calling an R function from C++ much slower than calling
> > the function from R? Is there any faster way to do the function call in C++?
>
>...
2017 Jun 27
0
Seg Fault memory violation
...f78d6539 in Rf_applyClosure (call=call at entry=0x17f3da88, op=op at entry=0x3ae4eb8,
---Type <return> to continue, or q <return> to quit---
arglist=arglist at entry=0x17f3db30, rho=rho at entry=0x17f3e0c0, suppliedvars=<optimized out>) at eval.c:1549
#22 0x00007ffff78d84bc in R_forceAndCall (e=e at entry=0x17f3da88, n=n at entry=1, rho=rho at entry=0x17f3e0c0) at eval.c:1676
#23 0x00007ffff782cd92 in do_lapply (call=<optimized out>, op=<optimized out>, args=<optimized out>, rho=0x17f3e0c0)
at apply.c:70
#24 0x00007ffff79092e9 in do_internal (call=<optimized ou...
2019 Jun 19
0
Fast way to call an R function from C++?
...ect.org> wrote:
> >
> > On Tue, 18 Jun 2019 at 19:41, King Jiefei <szwjf08 at gmail.com> wrote:
> > >
> > > [...]
> > >
> > > It is clear to see that calling an R function in R is the fast one, it
> is
> > > about 5X faster than ` R_forceAndCall ` and ` Rf_eval`. the latter two
> > > functions have a similar performance and using Rcpp is the worst one.
> Is it
> > > expected? Why is calling an R function from C++ much slower than
> calling
> > > the function from R? Is there any faster way to do the functio...