Displaying 4 results from an estimated 4 matches for "funbodi".
Did you mean:
funbody
2015 Jan 21
2
reducing redundant work in methods package
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. This
accounts for ~10% of package loading time. I'm sure there is some history
to that
2015 Jan 21
2
reducing redundant work in methods package
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 defined for primitive function %s
in this version of R",
2015 Jan 21
0
reducing redundant work in methods package
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 exact matching.
Have you tried patching methods to use .BasicFunsList directly as in
setMethod?
On
2015 Jan 22
0
reducing redundant work in methods package
I also just noticed that there is a bug: identical(ans, FALSE) should
be is.null(ans).
So no error is thrown:
> methods:::genericForPrimitive("foo")
NULL
Will fix.
On Wed, Jan 21, 2015 at 3:13 PM, Peter Haverty <haverty.peter at gene.com> wrote:
> Doing it like this:
>
> genericForPrimitive <- function(f, where = topenv(parent.frame()), mustFind
> = TRUE) {