This is more a style question. For CPU bound processes that really benefit for having multiple cores, do you typically use the multiprocessing module or use threads with an interpreter that doesn’t have the GIL? I’ve used the multiprocessing library only lightly, but also have no experience with anything besides CPython. I’m curious what the preferred approach is and if it is to use a different interpreter, which one.
Share
I don’t really see a “style” argument to be made here, either way — both
multiprocessingin CPython 2.6, andthreadingin (e.g.) the current versions of Jython and IronPython, let you code in extremely similar ways (and styles;-). So, I’d choose on the basis of very “hard-nosed” considerations — what is performance like with each choice (if I’m so CPU-bound as to benefit from multiple cores, then performance is obviously of paramount importance), could I use with serious benefit any library that’s CPython-only (likenumpy) or maybe something else that’s JVM- or .NET- only, and so forth.