From |uc@r @end|ng |rom |edor@project@org  Wed Jun 19 12:43:20 2019
From: |uc@r @end|ng |rom |edor@project@org (=?UTF-8?Q?I=C3=B1aki_Ucar?=)
Date: Wed, 19 Jun 2019 12:43:20 +0200
Subject: [Rd] Fast way to call an R function from C++?
In-Reply-To: <CAGiFhPOxoTvvG4hffr8deBsQX6RUaNuk0+guZLpkdSoNkRBgeA@mail.gmail.com>
References: <CAGiFhPONJoEeWWdtTyHw=Y5or1ad3pXtydLNQyONzU3FPatgPA@mail.gmail.com>
 <CALEXWq2g2XFAZ4tzjWuP65PDKXVx1HFK3DvsWVhtV18T61vKEQ@mail.gmail.com>
 <CALEXWq3q3uVXKsiOE=XTT5UxEWbCPF38JNbB8H+RTyioQOEN9w@mail.gmail.com>
 <CAGiFhPOxoTvvG4hffr8deBsQX6RUaNuk0+guZLpkdSoNkRBgeA@mail.gmail.com>
Message-ID: <CALEXWq26K35vw7cHCe-pHyV44ZajNvwhjsaZDpQ7r7in6Rgc1g@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



[Rd] Fast way to call an R function from C++?
=?UTF-8?Q?I=C3=B1aki_Ucar?=