[R-pkg-devel] Effieciency drop in do.call?
pd@lgd @ending from gm@il@com
Mon Nov 19 22:32:59 CET 2018
If it was just about args evaluation, then the slowness would be in the list() call, no?
An accidental deparse of a large structure could well be the culprit.
> On 19 Nov 2018, at 18:53 , Gabor Grothendieck <ggrothendieck using gmail.com> wrote:
> The do.call version evaluates all arguments while the normal version
> may not depending on the function. There could also be a difference
> if the function uses non-standard evaluation since in that case the
> two could be passing different different argument values.
> For an example of the second case,
> f <- function(x) deparse(substitute(x))
> ##  "pi"
> do.call("f", list(pi))
> ##  "3.14159265358979"
> On Mon, Nov 19, 2018 at 11:50 AM Paul Buerkner <paul.buerkner using gmail.com> wrote:
>> Hi all,
>> today, I stumbled upon a puzzling (to me) problem apparently related to
>> do.call() that resulted
>> in an efficiency drop of multiple orders of magnitudes compared to just
>> calling the function directly (multiple minutes as compared to one second).
>> That is
>> fun(a = a, b = b, c = c, ...)
>> took one second, while
>> args <- list(a = a, b = b, c = c, ...)
>> do.call(fun, args)
>> took multiple minutes.
>> In my package (brms), I use do.call in various places but only in one it
>> resulted in this
>> efficiency drop.
>> Before I try to make a reproducible example, I wanted to ask if there are
>> any known issues
>> with do.call that may explain this?
>> [[alternative HTML version deleted]]
>> R-package-devel using r-project.org mailing list
> Statistics & Software Consulting
> GKX Group, GKX Associates Inc.
> tel: 1-877-GKX-GROUP
> email: ggrothendieck at gmail.com
> R-package-devel using r-project.org mailing list
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Office: A 4.23
Email: pd.mes using cbs.dk Priv: PDalgd using gmail.com
More information about the R-package-devel