Re: [Rd] we need an exists/get hybrid

2014-12-04 Thread Sven E. Templer
David, 'assign' is slower than '<-': ## median expr ## 1 0.1440 X <- letters ## 2 0.4420 .Internal(assign("X", letters, e, F)) ## 3 1.1820 e[["X"]] <- letters ## 4 1.2570

Re: [Rd] we need an exists/get hybrid

2014-12-04 Thread Lorenz, David
All, So that suggests that .GlobalEnv[["X"]] is more efficient than get("X", pos=1L). What about .GlobalEnv[["X"]] <- value, compared to assign("X", value)? Dave On Wed, Dec 3, 2014 at 3:30 PM, Peter Haverty wrote: > Thanks Winston! I'm amazed that "[[" beats calling the .Internal > directly

Re: [Rd] we need an exists/get hybrid

2014-12-03 Thread Peter Haverty
Thanks Winston! I'm amazed that "[[" beats calling the .Internal directly. I guess the difference between .Primitive vs. .Internal is pretty significant for things on this time scale. NULL meaning NULL and NULL meaning undefined would lead to the same path for much of my code. I'll be swapping

Re: [Rd] we need an exists/get hybrid

2014-12-03 Thread Winston Chang
I've looked at related speed issues in the past, and have a couple related points to add. (I've put the info below at http://rpubs.com/wch/46428.) There’s a significant amount of overhead just from calling the R function get(). This is true even when you skip the pos argument and provide envir. Fo

[Rd] we need an exists/get hybrid

2014-12-03 Thread Peter Haverty
Hi All, I've been looking into speeding up the loading of packages that use a lot of S4. After profiling I noticed the "exists" function accounts for a surprising fraction of the time. I have some thoughts about speeding up exists (below). More to the point of this post, Martin M�chler noted tha