Re:Faster Python with Guido van Rossum
by amelius on Thursday October 07, 2021 @11:29AM
(#28787606)
Python's multiprocessing module forces you to serialize all your data, or use ctypes. This means it's either going to be slow, or it's like writing code in a hybrid of Pythonic and C-style code. Which of course goes against the idea of using the simplest tool for the job.
[ Parent
| on HN ]
You can use shared memory without ctypes: https://docs.python.org/3/library/multiprocessing.shared_mem...
But you still do have to jump through some hoops then. But like the example in the docs show there are shareable primitives, you can share numpy arrays, etc.