search for: sums4

Displaying 1 result from an estimated 1 matches for "sums4".

Did you mean: sums
2004 Mar 27
1
Re: [S] scalability
...a <- array(rnorm(3000*300*3), c(3000, 300, 3)) gc() system.time(jjsa <- apply(jja, 1:2, sum)) # takes 30 seconds sumS3 <- function(x, ...) UseMethod("sumS3") sumS3.default <- function(x, ...) sum(x, ...) gc() system.time(jjsa3 <- apply(jja, 1:2, sumS3)) # takes 65 seconds sumS4 <- function(x, ...) standardGeneric("sumS4") setMethod("sumS4", signature(x="numeric"), function(x, ...) sum(x, ...)) gc() system.time(jjsa4 <- apply(jja, 1:2, sumS4)) # takes 58 seconds Questions: It looks to me like the penalty for making the functions generi...