Last active
January 1, 2016 13:19
-
-
Save hadley/8150051 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(microbenchmark) | |
microbenchmark( | |
mtcars["Volvo 142E", "carb"], | |
mtcars[32, 11], | |
mtcars[[c(11, 32)]], | |
mtcars[["carb"]][32], | |
mtcars[[11]][32], | |
mtcars$carb[32], | |
.subset2(mtcars, "carb")[32], | |
.subset2(mtcars, 11)[32] | |
) | |
# Unit: nanoseconds | |
# expr min lq median uq max neval | |
# mtcars["Volvo 142E", "carb"] 22048 23630.0 24337.5 25206.5 50470 100 | |
# mtcars[32, 11] 19715 20807.0 21422.0 21945.0 99536 100 | |
# mtcars[[c(11, 32)]] 8302 9334.0 9818.0 10455.5 14462 100 | |
# mtcars[["carb"]][32] 8049 8832.5 9357.5 10180.0 20883 100 | |
# mtcars[[11]][32] 7867 8686.0 9326.0 9922.0 18266 100 | |
# mtcars$carb[32] 2358 3055.5 3321.0 3542.5 8411 100 | |
# .subset2(mtcars, "carb")[32] 515 754.0 825.5 930.5 1439 100 | |
# .subset2(mtcars, 11)[32] 362 610.5 679.0 755.0 2568 100# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment