We want to make styler faster.
library(styler)
microbenchmark::microbenchmark(
base = style_file("tests/testthat/indention_multiple/overall-in.R"),
times = 2
)
#> Unit: seconds
#> expr min lq mean median uq max neval
#> base 4.131253 4.131253 4.172017 4.172017 4.212781 4.212781 2
Replacing mutate statments.
microbenchmark::microbenchmark(
base = style_file("tests/testthat/indention_multiple/overall-in.R"),
times = 2
)
#> Unit: seconds
#> expr min lq mean median uq max neval
#> base 2.13616 2.13616 2.223659 2.223659 2.311158 2.311158 2
Move opening
argument out of needs indention.
microbenchmark::microbenchmark(
base = style_file("tests/testthat/indention_multiple/overall-in.R"),
times = 5
)
#> Unit: seconds
#> expr min lq mean median uq max neval
#> base 2.18097 2.184721 2.225294 2.200893 2.241799 2.318089 5
Dropping unnecessary select and arrange stuffstatments
microbenchmark::microbenchmark(
base = style_file("tests/testthat/indention_multiple/overall-in.R"),
times = 5
)
#> Unit: seconds
#> expr min lq mean median uq max neval
#> base 2.109271 2.134377 2.147821 2.158567 2.165384 2.171505 5
Some more stuff (early return, purr)
microbenchmark::microbenchmark(
base = style_file("tests/testthat/indention_multiple/overall-in.R"),
times = 5
)
#> Unit: milliseconds
#> expr min lq mean median uq max neval
#> base 930.4391 944.9253 969.2838 951.4632 951.6571 1067.934 5