Created
April 3, 2020 18:06
-
-
Save paleolimbot/fa4ab0acdbaadcda70f0b3600efe114b to your computer and use it in GitHub Desktop.
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
library(furrr) | |
slow_func <- function(x) { | |
Sys.sleep(0.1) | |
x | |
} | |
bench::mark(lapply(1:10, slow_func)) | |
# use this! | |
plan(multisession) | |
bench::mark(future_map(1:10, slow_func)) | |
# not this! | |
plan(multicore) | |
bench::mark(future_map(1:10, slow_func)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Created on 2020-04-03 by the reprex package (v0.3.0)