note also that magrittr is not the only way to pipe :
library(microbenchmark)
library(magrittr)
library(wrapr)
library(pipeR)
`%.%` <- function(e1,e2)
eval.parent(eval(substitute(substitute(e2,list(. = substitute(e1))))))
set.seed(99)
z = sample(10000,4,TRUE)
microbenchmark(
magrittr = z %>% unique %>% list,
wrapr = z %.>% unique %.>% list,
pipeR = z %>>% unique %>>% list,
simplistic_pipe = z %.% unique(.) %.% list(.),
fake_pipe = {z -> .; unique(.) -> .; list(.)},
list(unique(z)),
unit = "relative")
#> Unit: relative
#> expr min lq mean median uq
#> magrittr 16.022222 17.915254 16.209680 17.988950 15.820084
#> wrapr 8.911111 11.237288 9.257725 9.889503 8.974895
#> pipeR 7.200000 8.093220 7.295321 7.558011 6.979079
#> simplistic_pipe 3.555556 3.838983 6.233702 3.740331 3.497908
#> fake_pipe 1.133333 1.177966 1.072513 1.204420 1.154812
#> list(unique(z)) 1.000000 1.000000 1.000000 1.000000 1.000000
#> max neval cld
#> 18.3527013 100 c
#> 6.8246687 100 b
#> 7.1488277 100 b
#> 30.6248726 100 ab
#> 0.7298675 100 a
#> 1.0000000 100 a