python - Multiprocessing: long vs short running workers -


i trying multiprocessing distributed queue. there reason choose run on run2? feeling run2 more performant since not have overhead of returning control main process.

from multiprocessing import pool foo import my_distributed_queue queue  def process_msg(msg):   foo(msg)  def run():   pool = pool(4)   msg in queue:     pool.apply_async(process_msg, (msg, ))  def process_msg2():     msg in queue:       foo(msg)  def run2():   pool = pool(4)   in range(4):       pool.apply_async(process_msg2, ())  if __name__ == '__main__'   run()   #run2() 


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -