[datatable-help] Bigger table , smaller access time-how is this possible?
Ashim Kapoor
ashimkapoor at gmail.com
Mon Nov 28 10:38:14 CET 2011
Dear all,
Please see my reproducible example below. My question is why does the 2nd
table,which is bigger have a smaller access time ?
> library(xtable)
> library(data.table)
data.table 1.7.2 For help type: help("data.table")
> start.size<-6e+5
>
> time.data.table<-list()
>
> for (i in 0:1){
+ n<-start.size*10^i
+ n1<-n/5000
+
my.data.table<-data.table(index=1:n,seriesname=rep(as.character(as.hexmode(1:n1)),each=5000),value=rnorm(n))
+ setkey(my.data.table,"seriesname")
+
time.data.table[[i+1]]<-system.time(my.data.table[J(as.character(as.hexmode(n1/4))),])
+ }
>
> rbind(time.data.table[[1]],time.data.table[[2]])
user.self sys.self elapsed user.child sys.child
[1,] 0.008 0 0.008 0 0
[2,] 0.004 0 0.004 0 0
> time.data.table[[1]]
user system elapsed
0.008 0.000 0.008
> time.data.table[[2]]
user system elapsed
0.004 0.000 0.004
>
Many thanks,
Ashim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20111128/72f8784f/attachment.htm>
More information about the datatable-help
mailing list