[Rcpp-devel] Question on performance

Kyle Baron kyleb at metrumrg.com
Sun Sep 23 12:38:53 CEST 2018


It seems like the sourceCpp thing is the biggie.  That dropped about a
second of the time from something like 2.7 to 1.7 seconds

They also create mOutput and then re-create it every time it goes into
InsideLoop
https://github.com/jesusfv/Comparison-Programming-Languages-Economics/blob/master/RBC_Rcpp.R#L41
https://github.com/jesusfv/Comparison-Programming-Languages-Economics/blob/master/InsideLoop.cpp#L12

I just passed mOutput into InsideLoop and modified it there
https://github.com/kylebmetrum/Comparison-Programming-Languages-Economics/commit/89015a72a0cf673739e83e38d4a545db4886b879











On Sat, Sep 22, 2018 at 1:21 PM Dirk Eddelbuettel <edd at debian.org> wrote:

>
> On 22 September 2018 at 12:36, Michael Weylandt wrote:
> | I don't have time right now, but the offending line is here:
> |
> |
> https://github.com/jesusfv/Comparison-Programming-Languages-Economics/blob/master/RBC_Rcpp.R#L62
> |
> | which calls `sourceCpp` repeatedly on each loop iteration.
> |
> | Should be a one line change to move it outside the loop and un-sully the
> | good name of Rcpp.
>
> Nice catch!!  You should _definitely_ send him a PR. I also suggest to move
> the sourceCpp() outside the timed segment as I do not think he accounts for
> compilation in the other approaches (eg C++).
>
> Dirk
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>


-- 

Kyle Baron | Principal Scientist I

Metrum Research Group

2 Tunxis Road | Tariffville, CT 06081

p: 860-735-7043 ext. 202 | e: kyleb at metrumrg.com

<https://info.metrumrg.com/contact>
<https://www.linkedin.com/company/metrum-research-group-llc/>
<https://twitter.com/MetrumRG>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20180923/12b0e817/attachment.html>


More information about the Rcpp-devel mailing list