Displaying 1 result from an estimated 1 matches for "adds4".
Did you mean:
adds
2003 Aug 21
2
efficiency and memory use of S4 data objects
...x <- object$x+1
object
}
Typical times on my machine are:
> system.time(a <- addlist(10^6,10))
[1] 2.91 0.00 2.96 NA NA
> system.time(addlist(10^7,10))
[1] 28.03 0.44 28.65 NA NA
Here is a test function doing the same operation with a formal S4 data
representation:
addS4 <- function(len,iter) {
object <- new("MyClass",x=rnorm(len))
for (i in 1:iter) x(object) <- x(object)+1
object
}
The timing with len=10^6 increases to
> system.time(a <- addS4(10^6,10))
[1] 6.79 0.06 6.90 NA NA
With len=10^7 the operation fails altogether...