Fast way to call an R function from C++?
On Wed, 19 Jun 2019 at 07:42, King Jiefei <szwjf08 at gmail.com> wrote:
Hello Kevin and I?aki, Thanks for your quick responses. I sincerely appreciate them! I can see how complicated it is to interact with R in C. I?aki's suggestion is very helpful, I saw there is a lot of performance gain by turning the flag on, but sadly the best performance it can offer still cannot beat R itself. It is interesting to see that C++ is 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!
That is misleading. C++ code is faster, that's beyond doubt. But you are not running C++ code here, you are running R code. So what is faster, running R code or executing something that then runs R code? Obviously the first thing is the baseline, and from there, it can only get worse as you add more layers on top of it. I?aki