Pregunta
Running R CMD roxygen
en un gran paquete puede tomar un tiempo bastante largo. Es obvio que es ineficaz, así como que va a través de todo, independientemente de si un archivo ha cambiado desde la última llamada roxygen.
¿Algún consejo sobre la manera de acelerar las cosas?
Solución
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.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow