-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
Thanks so much for listenv. It is a great idea, and I have enjoyed using already. I am in over my head, but I thought some naive performance benchmarks would be interesting, since environment usually offers a big performance boost (see http://jeffreyhorner.tumblr.com/post/117059271933/hash-table-performance-in-r-part-iv)
library(microbenchmark)
library(listenv)
n <- 2e4
env_env <- function(){
env_env <- new.env()
for(x in seq.int(1,n)){
env_env[[as.character(x)]] <- runif(1)
}
env_env
}
list_env <- function(){
list_env <- listenv()
for(x in seq.int(1,n)){
list_env[[x]] <- runif(1)
}
list_env
}
list_list <- function(){
list_list <- list()
for(x in seq.int(1,n)){
list_list[[x]] <- runif(1)
}
list_list
}
mb <- microbenchmark(
env_env()
,list_env()
,list_list()
,times=10
)
autoplot(mb)