Dear all,<br><br>Please see my reproducible example below. My question is why does the 2nd table,which is bigger have a smaller access time ?<br><br>> library(xtable)<br>> library(data.table)<br>data.table 1.7.2 For help type: help("data.table")<br>
> start.size<-6e+5<br>> <br>> time.data.table<-list()<br>> <br>> for (i in 0:1){<br>+ n<-start.size*10^i<br>+ n1<-n/5000<br>+ my.data.table<-data.table(index=1:n,seriesname=rep(as.character(as.hexmode(1:n1)),each=5000),value=rnorm(n))<br>
+ setkey(my.data.table,"seriesname")<br>+ time.data.table[[i+1]]<-system.time(my.data.table[J(as.character(as.hexmode(n1/4))),])<br>+ }<br><br>> <br>> rbind(time.data.table[[1]],time.data.table[[2]])<br>
user.self sys.self elapsed user.child sys.child<br>[1,] 0.008 0 0.008 0 0<br>[2,] 0.004 0 0.004 0 0<br>> time.data.table[[1]]<br> user system elapsed <br>
0.008 0.000 0.008 <br>> time.data.table[[2]]<br> user system elapsed <br> 0.004 0.000 0.004 <br>> <br><br>Many thanks,<br>Ashim<br>