title: python queue thread performance
body: <p>I have 2 questions regarding thread and queue in python.</p>
  
  <ol>
  <li>What does <code>max_size</code> arg do in <code>queue.Queue()</code>?</li>
  <li>Are there any performance improvement depending on the # of threads(<code>num_worker_threads</code>)? I can't find any improvements on it. <br>
  -> If there's no improvements depending on the # of threads, why do we need this?</li>
  </ol>
  
  <pre class="lang-python prettyprint-override"><code>import time 
  import queue
  import threading
  
  num_worker_threads = 10
  
  store = []
  def worker():
      while True:
          item = q.get()
          if item is None:
              break
          store.append(item)
          q.task_done()
  
  
  start = time.time()        
  q = queue.Queue() # what does max_size do in queue?
  threads = []
  for i in range(num_worker_threads):
      t = threading.Thread(target=worker)
      t.start()
      threads.append(t)
  
  for item in range(1000000):
      q.put(item)
  
  # block until all tasks are done
  q.join()
  
  # stop workers
  for i in range(num_worker_threads):
      q.put(None)
  for t in threads:
      t.join()
  end = time.time()
  
  print('running time: {}'.format(end - start))
  </code></pre>