microbenchmark::microbenchmark(
dplyr = data.frame(A, B) %>% mutate(AB = pmax(A, B, na.rm = TRUE)),
DT = setDT(list(A,B))[, AB := pmax(A, B, na.rm = TRUE)],
justpmax = pmax(A,B),
times = 10
)
Unit: milliseconds
expr min lq mean median uq max neval cld
dplyr 854.7635 858.4828 863.0581 860.4776 866.4064 876.2322 10 a
DT 878.3649 885.8416 897.2747 892.0091 908.6812 925.2861 10 b
justpmax 855.0124 860.0458 865.3843 863.6564 873.7097 875.8555 10 a