Created
October 5, 2018 14:56
-
-
Save rmflight/241876cba79b5d5352f645a3c482daa7 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
| x = rnorm(500) | |
| library(microbenchmark) | |
| microbenchmark( | |
| replicate(5000, sample(x)), | |
| do.call(c, purrr::map(seq(1, 5000), function(.x){sample(x)})) | |
| ) | |
| #Unit: milliseconds | |
| #expr | |
| #replicate(5000, sample(x)) | |
| #do.call(c, purrr::map(seq(1, 5000), function(.x) { sample(x) })) | |
| #min lq mean median uq max neval | |
| #75.48671 89.02109 118.58633 96.94587 127.36513 267.1767 100 | |
| #68.85197 75.65118 91.94416 80.93999 89.59123 196.6865 100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment