Cython help: Time taken to execute a function (profiling) changes drastically depending on image size