Enable optional parallel site building#383
Conversation
yihui
left a comment
There was a problem hiding this comment.
Yes, I'd love to have this feature. Please finish up whatever you planned to do, and let me know when the PR is ready for review. Thank you very much!
|
I would consider this ready to be reviewed, just not sure about the "UI" in terms of using the feature. I am a fan of conservative introduction of new features, but happy to change. |
|
@yihui, is there anything waited on from my side? |
yihui
left a comment
There was a problem hiding this comment.
Sorry about the delay. I just added my own proposal (which is even more conservative but also more general). Please let me know what you think. Thanks!
| if (local && length(files)) { | ||
| files = getOption('blogdown.files_filter', timestamp_filter)(files) | ||
| } | ||
| build_rmds(files) |
There was a problem hiding this comment.
I thought a while about it and I tend to let users decide how to parallelize it because there are multiple ways of parallelization. Here is how I'd implement it:
build_fun = getOption('blogdown.build_rmds', function(files, build) {
build(files)
})
build_fun(files, build_rmds)Then users can set their own functions (in .Rprofile), e.g.
options(blogdown.build_rmds = function(files, build) {
parallel::mclapply(files, build)
})There was a problem hiding this comment.
-
Updated the approach to hopefully be in line with your though process, albeit still exposing the
build_funas a parameter, not just retrieving it from options within the function. We can also remove the parameter if you like the other approach better. -
Would suggest to keep the
build_rmds_parallel(), as it gives users an easy way to get parallelization without having to implement themselves, using eitheroptions("blogdown.build_rmds" = blogdown:::build_rmds_parallel)or (assuming we keep the parameter) calling directly
blogdown::build_site(build_fun = blogdown:::build_rmds_parallel)
102e98f to
129cf50
Compare
|
Just some thoughts about letting user choose how to do parallel. 💭
Thanks for this feature by the way ! |
Thanks for the feedback!
|
|
Hi @yihui, do we still want to move this forward? |
This PR proposes an option to
build_site()using multiple parallel-running R processes, utilizing only the base packageparallel. This can result in significant speed improvements with hardware common in 2019.To enable the parallelization, the user must specify 2 options:
The functionality is only triggered if:
blogdown.use_parallelisTRUEblogdown.use_parallel.coresis> 1filesis> 1parallelpackage is availableIf this direction of functionality is accepted, we can make the implementation less conservative and easier to use.