future: value(fs) is better than lapply(fs, value)
- Dominant language
- C++
- Stars
- 607
- Forks
- 67
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 1
Description
Hello, these days, as the author of Futureverse, I recommend to use:
```r
ys <- value(fs)
```
instead of:
```r
ys <- lapply(fs, value)
```
One reason is that it `value(fs)` on a set of futures `fs` supports early stopping in case of errors and interrupts. For instance, if the user interrupts the processing, `value(fs)` will cancel all active futures, which results in `value(fs)` exiting much sooner. Same happens if one of the futures result in an error -- all other futures will be canceled and then the error is produced. This will not happen when using `lapply(fs, value)`.
Here's one example where you could update your code accordingly:
https://github.com/greta-dev/greta/blob/ddc98fb47c5f278465035abeb1b32633febb3737/R/inference.R#L388
Contributor guide
Assessment
This issue has not been assessed yet.