[Rcpp-devel] Rcpp::plugins - Unwinding protection

Iñaki Ucar iucar at fedoraproject.org
Fri Dec 3 19:47:25 CET 2021

On Fri, 3 Dec 2021 at 19:27, Dirk Eddelbuettel <edd at debian.org> wrote:
> On 3 December 2021 at 17:03, Iñaki Ucar wrote:
> | On Fri, 3 Dec 2021 at 15:44, Víthor Rosa <vrosafranco at gmail.com> wrote:
> | >
> | > Thank you for your response. Adding my functions to an R package and changing the Makevars file as suggested reduced the runtime by half. Excited for Rcpp 1.0.8! :)
> |
> | Excellent! Glad it helped.
> I have been sitting on a branch at GitHub that defines new / easier /
> alternate header files as entry points. So instead of starting with Rcpp.h
> (possibly combined with #define statements) one could now pick exactly one
> off these three
>    #include <Rcpp/Light>
>    #include <Rcpp/Lighter>
>    #include <Rcpp/Lightest>
> which turn off, respectively, Modules, RTTI and Sugar. See the commit at [1]
> for more and full code, it's essentially a define each and simple nesting.
> Each of these shaves a little bit of the compile times.  (I need to rebase it
> to current master, it's a few months old.)
> But I had not yet convinced myself it would be useful / of interest.  But as
> this thread shows, there may be interest.  Any comments? Yay? Nay?

Mmmh, no strong opinions here. I think it doesn't matter much whether
it's an include or a define. What matters most is whether this is
discoverable and the user understands what it does.

In this particular case, Víthor is interested in runtime performance.
Disabling modules and RTTI (and Sugar if he's not using that) will
save some compilation time, but won't help with runtime performance.

@Víthor, the TL;DR is that you can append -DRCPP_NO_RTTI to your
PKG_CPPFLAGS in the Makevars file. This disables some functionality
that you are probably not using, and compilation will be faster too.


> (And as discussed turning UNWIND_PROTECT on globally is also a good idea but
> may need a proper transition, and is hence for now outside the scope of this
> branch.)
> Dirk
> [1] https://github.com/RcppCore/Rcpp/commit/5cf57ff663d06acf42124feae51d469f3f77be52#diff-05c80375618a46d399d73e4f32a3006aa698b9bb293a37c6d2e431a1c541b7bb
> --
> https://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org

Iñaki Úcar

More information about the Rcpp-devel mailing list