Writing to shared memory in Python is very slow
问题 I use python.multiprocessing.sharedctypes.RawArray to share large numpy arrays between multiple processes. And I've noticed that when this array is large (> 1 or 2 Gb) it becomes very slow to initialize and also much slower to read/write to (and read/write time is not predictable, sometimes pretty fast, sometimes very very slow). I've made a small sample script that uses just one process, initialize a shared array and write to it several times. And measures time to do these operations. import