Re: [R-pkg-devel] Effieciency drop in do.call?

2018-11-19 Thread peter dalgaard
A classical way of encountering this is x <- rnorm(1000) do.call("plot", list(x)) A way out is do.call("plot", list(quote(x))) -pd > On 19 Nov 2018, at 22:32 , peter dalgaard wrote: > > If it was just about args evaluation, then the slowness would be in the > list() call, no? > An accident

Re: [R-pkg-devel] Effieciency drop in do.call?

2018-11-19 Thread Paul Buerkner
Thanks! You are likely right that this was the problem. Actually, I was using a pattern of the form args <- nlist(a, b, c, ...) do.call(fun, args) where nlist() uses NSE to set names for unnamed arguments. As I was passing big model objects and data through multiple layers of do.call(), it is no

Re: [R-pkg-devel] Effieciency drop in do.call?

2018-11-19 Thread peter dalgaard
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. -pd > On 19 Nov 2018, at 18:53 , Gabor Grothendieck wrote: > > The do.call version evaluates all arguments while the normal version >

Re: [R-pkg-devel] Effieciency drop in do.call?

2018-11-19 Thread Gabor Grothendieck
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,

[R-pkg-devel] Effieciency drop in do.call?

2018-11-19 Thread Paul Buerkner
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