Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save strboul/6e5e41eb45015ec681357a7bab1e792b to your computer and use it in GitHub Desktop.
Save strboul/6e5e41eb45015ec681357a7bab1e792b to your computer and use it in GitHub Desktop.
library(microbenchmark)
x <- sample(100000)
microbenchmark(x[order(x, method = "auto")],
x[order(x, method = "shell")],
x[order(x, method = "radix")])
# Unit: milliseconds
# expr min lq mean median uq max
# x[order(x, method = "auto")] 1.790454 1.863924 2.128368 1.930263 2.362573 3.328237
# x[order(x, method = "shell")] 17.530465 17.991802 18.914891 18.641179 19.763667 21.762103
# x[order(x, method = "radix")] 1.791103 1.847488 2.439882 1.975531 2.265257 33.209701
# neval
# 100
# 100
# 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment