library(tidyverse)
## -- Attaching packages --------------------------------------------------------------------------------------------------------------------------- tidyverse 1.2.1 --
## v ggplot2 3.0.0          v purrr   0.2.5     
## v tibble  2.1.1.9000     v dplyr   0.8.0.9013
## v tidyr   0.8.2.9000     v stringr 1.3.1     
## v readr   1.3.1.9000     v forcats 0.3.0
## -- Conflicts ------------------------------------------------------------------------------------------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
pre_defined_empty_list<-function(){
  # create list and then assign values
  full_length<-10000
  empty_list <- vector(mode = "list", length = full_length)
  for (i in 1:full_length){
    empty_list[[i]]=i*10
  }
  return(empty_list)
}

append_list<-function(){
  full_length<-10000
  empty_list<-list()
  
  for (i in 1:full_length){
    empty_list[[i]]=i*10
  }
  return(empty_list)
}

res=microbenchmark::microbenchmark(pre_defined_empty_list(),
                                    append_list())


microbenchmark::autoplot.microbenchmark(res)
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.