Venkatesh-Prasad Ranganath
1 min readJul 1, 2018

--

functools.partial creates a function object that contains the partial argument list. Since this object is created in the master process and it is not available in the worker process, it will be sent to the worker process with each work request; hence, this solution will be equivalent to the solution without the initializer.

If you benchmark the solution by switching the order of parameters/arguments on line 8 and 58, dropping the initilizer and aux_data on line 33, and using functools.partial(worker, aux_data) instead of with_initializer_worker_wrapper on line 37, then you will see the run times for with and without initializers are comparable.

Hope this helps,

--

--

Venkatesh-Prasad Ranganath

Engineer / Ex-Academic / Ex-Researcher curious about software and computing.