<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>6. joblib.Parallel creates/destroys a multiprocessing.Pool each time the Parallel object is `__call__`ed. This leads to significant overhead. One can use the Parallel object with a context manager, which allows reuse of the Pool, but I don't think that's do-able in the context of using the DifferentialEvolutionSolver (DES) object as an iterator:</div></div></blockquote><div><br></div><div>If you can use `__iter__` instead of `__next__` in your <span style="font-size:12.8px">DifferentialEvolutionSolver </span>class I think you can avoid this problem with something along the lines of:</div><div class="gmail-markdown-here-wrapper"><pre style="font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;background-color:rgb(248,248,248);white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block">class DifferentialEvolutionSolver(object):
...
def __iter__(self):
with Parallel(...) ...:
for it in ...:
yield it
</code></pre><div title="MDH:PGRpdj5gYGA8L2Rpdj48ZGl2PmNsYXNzJm5ic3A7PHNwYW4gc3R5bGU9ImZvbnQtc2l6ZTogMTIu
OHB4OyI+RGlmZmVyZW50aWFsRXZvbHV0aW9uU29sdmVyKG9iamVjdCk6PC9zcGFuPjwvZGl2Pjxk
aXY+PHNwYW4gc3R5bGU9ImZvbnQtc2l6ZTogMTIuOHB4OyI+Jm5ic3A7ICZuYnNwOyAuLi48L3Nw
YW4+PC9kaXY+PGRpdj4mbmJzcDsgJm5ic3A7IGRlZiBfX2l0ZXJfXyhzZWxmKTo8L2Rpdj48ZGl2
PiZuYnNwOyAmbmJzcDsgJm5ic3A7ICZuYnNwOyB3aXRoIFBhcmFsbGVsKC4uLikgLi4uOjwvZGl2
PjxkaXY+Jm5ic3A7ICZuYnNwOyAmbmJzcDsgJm5ic3A7ICZuYnNwOyAmbmJzcDsgZm9yIGl0IGlu
IC4uLjo8L2Rpdj48ZGl2PiZuYnNwOyAmbmJzcDsgJm5ic3A7ICZuYnNwOyAmbmJzcDsgJm5ic3A7
ICZuYnNwOyAmbmJzcDsgeWllbGQgaXQ8L2Rpdj48ZGl2PmBgYDwvZGl2PjxkaXY+PC9kaXY+" style="height:0px;width:0px;max-height:0px;max-width:0px;overflow:hidden;font-size:0em;padding:0px;margin:0px">​</div></div><div>As for the map problem I don't know, but it's probably worth asking the `joblib` people if there is a suitable solution or workaround.</div><div><br></div><div>Eric</div><div><br></div></div></div></div>