Message-ID: <CALEXWq26K35vw7cHCe-pHyV44ZajNvwhjsaZDpQ7r7in6Rgc1g@mail.gmail.com>
Date: 2019-06-19T10:43:20Z
From: IƱaki Ucar
Subject: Fast way to call an R function from C++?
In-Reply-To: <CAGiFhPOxoTvvG4hffr8deBsQX6RUaNuk0+guZLpkdSoNkRBgeA@mail.gmail.com>
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