Running R CMD roxygen
on a big package can take quite a long time. It's obviously inefficient as well as it goes through everything regardless of whether a file has changed since the last roxygen call.
Any tips on how to speed things up?
Roxygen2 > 3.0.0 is substantially faster, and no longer needs caching.
In my local version of roxygen, I have:
library(memoize)
cached.parse.ref <- memoize(parse.ref)
cached.parse.srcfile <- memoize(parse.srcfile)
parse.file <- function(file) {
srcfile <- srcfile(file)
res <- try(cached.parse.srcfile(srcfile), silent = TRUE)
if (inherits(res, "try-error")) {
stop("Can't pass", file, "\n", res, call. = FALSE)
}
res
}
parse.srcfile <- function(srcfile) {
srcrefs <- attributes(parse(srcfile$filename,
srcfile=srcfile))$srcref
if (length(srcrefs) > 0)
parse.refs(zip.list(prerefs(srcfile, srcrefs), srcrefs))
else
nil
}
I think those are the only changes you need, but I'm not sure. It speeds up roxygen by an order of magnitude.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With