Re: [Rd] reducing redundant work in methods package

2015-01-21 Thread Peter Haverty
Doing it like this: genericForPrimitive <- function(f, where = topenv(parent.frame()), mustFind = TRUE) { ans = .BasicFunsList[[f]] ## this element may not exist (yet, during loading), dom't test null if(mustFind && identical(ans, FALSE)) stop(gettextf("methods may not be d

Re: [Rd] reducing redundant work in methods package

2015-01-21 Thread Michael Lawrence
Note that setMethod() resolves .BasicFunsList in the methods namespace directly when setting a method on a primitive. Somehow there should be consistency between genericForPrimitive() and the check in setMethod(). Also, we can probably step away from the use of elNamed(), given that [[ now uses ex

[Rd] reducing redundant work in methods package

2015-01-21 Thread Peter Haverty
Hi all, The function call series genericForPrimitive -> .findBasicFuns -> .findAll happens 4400 times while the GenomicRanges package is loading. Each time .findAll follows a chain of environments to determine that the methods namespace is the only one that holds a variable called .BasicFunsList.