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
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help