[R-pkg-devel] speeding up package code/build/test cycle

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Thu Jun 24 20:55:29 CEST 2021

On 24/06/2021 5:15 a.m., Greg Minshall wrote:
> hi.
> when developing packages, my current work flow is to change the code,
> (re-)build the package, detach/load the package, test (to find the
> N+1'st bug, sigh).
> the building step takes tens of seconds.
> is there an obvious way to present some code to the R command line and
> have it replace the appropriate function in a given package?
> or, are there other things people do to speed up this process?

Wolfgang pointed out the devtools way to do this.  I don't use that for 
rgl (a pretty slow 75 second from scratch), but I find R CMD INSTALL 
pkgdir works fast enough:  if C++ source has already been compiled, it 
won't be compiled again, as it would be if I installed from a tarball. 
A second build after a clean build takes about 15 seconds.  That's 
acceptable for me.

A disadvantage of the devtools method is that a regular build after 
load_all() seems to do a full 75 sec build:  load_all caches things for 
itself, but doesn't put them in the same place as a regular build, so 
make doesn't see the object files, and rebuilds all of them.  Or at 
least it did that last time I tried it, a few months ago.

As Dirk said, you can also use command line options to suppress building 
vignettes or other things if they take too long.

Duncan Murdoch

More information about the R-package-devel mailing list