2 ms·
>I am not an expert in python but I feel that the JS model where everything is on the event loop and there is no actual threads seem better for a dynamic langua
by logicchains 3y ago
>I am not an expert in python but I feel that the JS model where everything is on the event loop and there is no actual threads seem better for a dynamic language
Python has become essentially the primary language for scientific computing and deep learning, and for this the JavaScript approach is absolutely inadequate. Real shared memory parallelism is needed to avoid the unnecessary copying that the subprocess approach entails.
>I don't know, this just feels better and simpler? If you really need to you can go down to a lower level language for full memory sharing data structures
A low level language is already used in Numpy, PyTorch etc., but that's not enough; the Python glue code becomes unnecessarily painful when using multiprocessing, pain that would go away with proper threads.
- DanielHB 3y agoIf you disregard the existing libraries and think purely about the concepts and powers of the languages, the JS model seems better to me. You can avoid memory copying between workers by using SharedArrayBuffer