A Future for R: A Comprehensive Overview
So I&#x27;ve actually tried to use the futures package. While it&#x27;s very clean for certain types of tasks, there are a few problems that I think are inherent to the way R deals with its parallel packages (which the futures package is built on top of).<p>Futures is great for tasks where you have some kind of task workflow like:<p><pre><code>    # slow task 1 --------,
    #                      ----&gt; task 3
    # slow task 2 --------&#x27;

    do_stuff &lt;- function(input1, input2) {
      result1 &lt;- slow_task1(input1)
      result2 &lt;- slow_task2(input2)
      task3(result1, result2)
    }
</code></pre>
Because then you can just do something like:<p><pre><code>    library(futures)
    plan(multicore)
    do_stuff &lt;- function(input1, input2) {
      result1 %&lt;-% slow_task1(input1)
      result2 %&lt;-% slow_task2(input2)
      task3(result1, result2)
    }
</code></pre>
And boom, you can have two tasks running in parallel and everything &quot;just works.&quot; It&#x27;s <i>extremely</i> nice to use thanks to R&#x27;s promises capability.<p>Where it falls down is when you try to load up a bunch of futures at once... I&#x27;m not clear on the implementation details, but from what I can tell every parallel task is assigned a &quot;port&quot; on your system, but if there is a port conflict (or the OS doesn&#x27;t &quot;release&quot; (?) the port quickly enough) tasks simply die with an inscrutable error.<p>I&#x27;ve found that it&#x27;s necessary to 1. ensure that only one &quot;set&quot; of parallel tasks are running at one time, and 2. create a central &quot;port registry&quot; and manually assign ports randomly within nonoverlapping ranges for parallel tasks. It&#x27;s straightforward but frustrating to do.<p>Finally (and I don&#x27;t know if the futures package has updated since I tried it out last year) it doesn&#x27;t work on Windows, which is a problem for many R users.