title: What batch_size and pre_dispatch in joblib exactly mean
body: <p>From documentation here <a href="https://pythonhosted.org/joblib/parallel.html#parallel-reference-documentation" rel="noreferrer">https://pythonhosted.org/joblib/parallel.html#parallel-reference-documentation</a>
  It's not clear for me what exactly <code>batch_size</code> and <code>pre_dispatch</code> means.</p>
  
  <p>Let's consider case when we are using <code>'multiprocessing'</code> backend, 2 jobs (2 processes) and we have 10 tasks to compute.</p>
  
  <p>As i understand:</p>
  
  <p><code>batch_size</code> - controls amount of pickled tasks at one time, so if you set <code>batch_size = 5</code> - joblib will pickle and send 5 tasks immediately to each process, and after arriving there they will be solved by process sequentially, one after another. With <code>batch_size=1</code> joblib will pickle and send one task at a time, if and only if that process completed previous task.</p>
  
  <p>To show what i mean:</p>
  
  <pre><code>def solve_one_task(task):
      # Solves one task at a time
      ....
      return result
  
  def solve_list(list_of_tasks):
      # Solves batch of tasks sequentially
      return [solve_one_task(task) for task in list_of_tasks]
  </code></pre>
  
  <p>So this code:</p>
  
  <pre><code>Parallel(n_jobs=2, backend = 'multiprocessing', batch_size=5)(
          delayed(solve_one_task)(task) for task in tasks)
  </code></pre>
  
  <p>is equal to this code (in perfomance):</p>
  
  <pre><code>slices = [(0,5)(5,10)]
  Parallel(n_jobs=2, backend = 'multiprocessing', batch_size=1)(
          delayed(solve_list)(tasks[slice[0]:slice[1]]) for slice in slices)
  </code></pre>
  
  <p>Am i right? And what <code>pre_dispatch</code> means then?</p>