title: How can i transform my code to use multiprocessing(pool)?
body: <pre><code>for key in copy_reference_dataset:
      model_line_number = 0
      model_dictionary_elements_number = len(copy_reference_dataset[key])
      while model_line_number &lt; model_dictionary_elements_number:
  
  
          compt = compt + 1
          if key in plus_min_dict:
              plus_min_dict[key].append(copy_reference_dataset[key][model_line_number])
          else:
              plus_min_dict[key] = [copy_reference_dataset[key][model_line_number]]
  
          validation_bool = False
          dictionary_elements_number = len(compared_to_dataset[key])
          ra = Rectangle(int(copy_reference_dataset[key][model_line_number][0]),
                         int(copy_reference_dataset[key][model_line_number][1]),
                         int(copy_reference_dataset[key][model_line_number][2]),
                         int(copy_reference_dataset[key][model_line_number][3]))
          model_line_number = model_line_number+1
          line_number = 0
          while line_number &lt; dictionary_elements_number and \
                  validation_bool is False:
  
              rb = Rectangle(int(copy_compared_to_dataset[key][line_number][0]),
                             int(copy_compared_to_dataset[key][line_number][1]),
                             int(copy_compared_to_dataset[key][line_number][2]),
                             int(copy_compared_to_dataset[key][line_number][3]))
              # print (rb)
              line_number = line_number + 1
              if area(ra, rb) &gt;= (area(ra, ra)/2):
                  # print ('ground truth area is' )
                  plus_precision = plus_precision + 1
                  validation_bool = True
  
  
              elif line_number == dictionary_elements_number:
                  minus_precision = minus_precision + 1
  </code></pre>
  
  <p>My code is fully functional but pretty slow due to to the iterations and comparisons between 2 dictionaries where the values of each can surpass 300000 items, i've done some research about multiprocessing and realized that pool might be the best choice and running over 4 processors in parallel should be a good option, any hints on how to implement my first multiprocessing adjustments will be appreciated.</p>