Why are multiprocessing.sharedctypes assignments so slow?
问题 Here's a little bench-marking code to illustrate my question: import numpy as np import multiprocessing as mp # allocate memory %time temp = mp.RawArray(np.ctypeslib.ctypes.c_uint16, int(1e8)) Wall time: 46.8 ms # assign memory, very slow %time temp[:] = np.arange(1e8, dtype = np.uint16) Wall time: 10.3 s # equivalent numpy assignment, 100X faster %time a = np.arange(1e8, dtype = np.uint16) Wall time: 111 ms Basically I want a numpy array to be shared between multiple processes because it's