我有一个简单的操作,我读取了几个 csv,绑定它们,然后导出,但vroom
执行速度比其他方法慢得多。我一定做错了什么,但我不确定是什么,或者为什么。
library(readr)
library(vroom)
library(data.table)
library(microbenchmark)
write_csv(mtcars, "test.csv")
microbenchmark(
readr={
t <- read_csv("test.csv", col_types=cols())
write_csv(t, "test.csv")
},data.tabl={
t <- fread("test.csv")
fwrite(t, "test.csv", sep=",")
},vroom={
t <- vroom("test.csv", delim=",", show_col_types = F)
vroom_write(t, "test.csv", delim=",")
},
times=10
)
#> Unit: milliseconds
#> expr min lq mean median uq max neval
#> readr 12.636961 12.662955 15.865400 12.928211 13.503029 41.104583 10
#> data.tabl 2.200815 2.275252 2.633456 2.342797 2.529283 4.830134 10
#> vroom 57.376353 57.915135 64.280365 58.496847 58.966311 117.150837 10
由reprex 包于 2021-07-01 创建 (v2.0.0 )