[Rd] Slow try in combination with do.call
Alexander Kaever
A|ex@nder@K@ever @end|ng |rom evotec@com
Thu Sep 16 16:00:03 CEST 2021
Hi,
It seems like a try(do.call(f, args)) can be very slow on error depending on the args size. This is related to a complete deparse of the call using deparse(call)[1L] within the try function. How about replacing deparse(call)[1L] by deparse(call, nlines = 1)?
Best,
Alex
Example:
fun <- function(x) {
stop("testing")
}
d <- rep(list(mtcars), 10000)
object.size(d)
# 72MB
system.time({
try(do.call(fun, args = list(x = d)))
})
# 8s
Unsere Informationen zum Datenschutz finden Sie hier<https://www.evotec.com/de/about/site-information/datenschutzbestimmungen>.
Evotec International GmbH, Hamburg. Amtsgericht Hamburg HRB 72242
Geschäftsführung: Dr. Cord Dohrmann, Dr. Craig Johnstone, Enno Spillner
STATEMENT OF CONFIDENTIALITY.
This email and any attachments may contain confidential, proprietary, privileged and/or private information.
If received in error, please notify us immediately by reply email and then delete this email and any attachments from your system. Thank you.
More information about the R-devel
mailing list