futureverse / futureverse/listenv

naive performance benchmarks

Open
#8 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
R
Stars
31
Forks
2
PR merge metrics
No merged PRs in 30d

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)

``` r
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)
```

![image](https://cloud.githubusercontent.com/assets/837910/9235905/422c402c-4107-11e5-8cbb-0e366681703b.png)

Contributor guide

Open the contributing guide

Research direction

Start with the supplied R example and compare the `environment`, `listenv`, and regular-list cases using `microbenchmark`. Clarify where reproducible benchmarks should live and which results are expected; done means the agreed benchmark output is recorded for these comparisons.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
performance
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.