title: Python tree building with multiprocessing pool - no speedup
body: <p>I am trying to implement multi-threaded building of binary tree using multiprocessing Pool in python. The main idea is that having N hardware threads available, at the certain level I'd like to create each of the branches of the tree in separate thread. There are no data dependencies and each of the recursive calls works on its own data, so there are no concerns related to data races. I am familiar with GIL constraints, therefore I've decided to use multiprocessing pool:</p>
  
  <pre><code>pool = Pool(processes=4)
  tree = Tree.createTreeMT(points, pool, 2);
  </code></pre>
  
  <p>The problem is i am not able to get any speedups. The function creating the tree looks like that:</p>
  
  <pre><code>def createTreeMT(points, pool, level = 2):
      # If there are no more points to process
      if len(points) &lt; 1:
          return
  
      # Divide points into two groups:
      left_points = ....
      right_points = ....
  
      tree = Tree()
  
      if(level == 0):
          if len(left_points) &gt; 0:
              leftPointsResult = pool.apply_async(createTree, (left_points))
          if len(right_points) &gt; 0:
              rightPointsResult = pool.apply_async(createTree, (right_points))
  
          if(leftPointsResult):
              tree.left = leftPointsResult.get()
          if(rightPointsResult):
              tree.right = rightPointsResult.get()
      else:
          if len(left_points) &gt; 0:
              tree.left = createTreeMT(left_points, pool, level-1)
  
          if len(right_points) &gt; 0:
              tree.right = createTreeMT(right_points, pool, level-1)
  
      return tree
  
  
  def createTree(points):
      # If there are no more points to process
      if len(points) &lt; 1:
          return
  
      # Divide points into two groups:
      left_points = ....
      right_points = ....
  
      tree = Tree()
  
      if len(left_points) &gt; 0:
          tree.left = createTree(left_points)
  
      if len(right_points) &gt; 0:
          tree.right = createTree(right_points)
  
      return tree
  </code></pre>
  
  <p>Am I doing something wrong ? Is there a better way to perform such task in standard python 2.7 ? </p>