thread, multiprocessing: communication overhead

Duncan Booth duncan.booth at invalid.invalid
Tue Dec 30 20:40:17 CET 2008


mk <mrkafk at gmail.com> wrote:

>> CMIIW, but I believe your timing function includes the time to launch
>> the actual processes and threads, create the synch. objects, etc.  You
>> might try it again, creating them first, starting the timer, then
>> loading them.
> 
> Except I don't know how to do that using timeit.Timer. :-/
> 
Easy enough: put the code into a class which creates the worker pool when 
instantiated and has a method to execute the code you want to time. Then 
you create an instance from the setup argument and time a call to the 
method.



More information about the Python-list mailing list