The World’s Largest Online Community for Developers
I am trying to use c++ for faster list loop check from python with ctypes. The problem is that making an argument (don't know how to call it...) takes a lot of time, while function itself is very fast
I am passing a big list (image).
arra = cv2.imread('../smthg.jpg').reshape(1000*1000*3) lib = ctypes.CDLL('./library.so') lib.function.restype = ndpointer(dtype=ctypes.c_int, shape=(1000*1000*3,)) arr = (ctypes.c_int * len(arra))(*arra) ### very slow (~1.4s) res = lib.function(arr) ### the function itself