- Compile the C profile: gcc -m64 -o libpycall2.so -shared -fPIC demo.c
- Run the python profile.
We use a 21003*2100 numpy array in the experiment, the second time subtracts the first time is the time that ctypes used, and the third time subtracts the second time is the time that Python used. We accelerated the calculation over than 100x by using this method.