Last active
March 4, 2018 16:02
-
-
Save gshotwell/cb6c021cea719fab7994892c3b2d5e76 to your computer and use it in GitHub Desktop.
split benchmarks
This file contains 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
> test_df6 <- create_test_df(cols=4, rows=40, levels_per_var= 6) # See appendix for 'create_test_df' | |
> g_test_df6 <- group_by(test_df6, a, b, c) | |
> | |
> base_split <- function(df)split(test_df6 , test_df6[, c('a', 'b', 'c')]) | |
> | |
> microbenchmark::microbenchmark( | |
+ base_split(test_df6), | |
+ split(g_test_df6) | |
+ ) | |
#Unit: milliseconds | |
# expr min lq mean median uq max neval | |
# base_split(test_df6) 17.671272 18.45257 20.843889 20.399100 22.14294 28.824846 100 | |
# split(g_test_df6) 1.466561 1.59341 1.910306 1.668386 1.87340 5.554186 100 | |
> | |
> microbenchmark::microbenchmark( | |
+ base_split(test_df6), | |
+ split(group_by(test_df6, a, b, c)) | |
+ ) | |
#Unit: milliseconds | |
# expr min lq mean median uq max neval | |
# base_split(test_df6) 17.723653 18.409159 20.52208 19.996392 22.072682 35.195378 100 | |
# split(group_by(test_df6, a, b, c)) 2.212929 2.353382 2.60777 2.456671 2.615488 6.183901 100 | |
## One Grouping Variable | |
> test_df6 <- create_test_df(cols=4, rows=40, levels_per_var= 6) # See appendix for 'create_test_df' | |
> g_test_df6 <- group_by(test_df6, a) | |
> base_split <- function(df)split(test_df6 , test_df6[, c('a')]) | |
> microbenchmark::microbenchmark( | |
+ base_split(test_df6), | |
+ split(g_test_df6) | |
+ ) | |
#Unit: microseconds | |
# expr min lq mean median uq max neval | |
# base_split(test_df6) 1110.054 1175.8550 1386.9527 1242.724 1366.0990 3681.738 100 | |
# split(g_test_df6) 336.510 368.6955 436.1724 401.180 450.2485 1557.041 100 | |
> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment