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

Gábor Csárdi c@@rd|@g@bor @end|ng |rom gm@||@com
Thu Jun 24 21:44:37 CEST 2021


On Thu, Jun 24, 2021 at 8:55 PM Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
[...]
> 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.

That is definitely not how load_all() should work, so this might be a
bug. AFAIK it does not use a special cache or anything, just compiles
the files inside the package tree, like a regular package install from
a package tree. This is a regular install after load_all():

❯ system.time(devtools::load_all())
ℹ Loading rgl
This build of rgl does not include OpenGL functions.  Use
 rglwidget() to display results, e.g. via options(rgl.printRglwidget = TRUE).
   user  system elapsed
  0.411   0.024   0.446

❯ q()

❯ time R CMD INSTALL .
* installing to library ‘/Users/gaborcsardi/Library/R/4.0/library’
[...]
* DONE (rgl)
R CMD INSTALL .  9.95s user 1.28s system 97% cpu 11.503 total

So a load_all() that does not need to recompile anything, just reload
the R code, takes less than half a second. After that a regular
install from the command line takes about 12s, most of which is the
byte compilation. If I turn byte compilation off, then it is less than
6s.

But it is rare that you actually need to install the package while
working on it, and you typically just use load_all() to iterate, or
devtools::test() if you use testthat.

Gabor

[...]



More information about the R-package-devel mailing list