Hi, Dan wrote: > cdef long spam = 0
Note that this uses a C long, which is size bound (as opposed to a Python long). Depending on your data, you might need more than that, e.g. a "long long" (although that's not 100% portable). > cdef int i = 0 Make sure you use Py_ssize_t also for i! > for i in range(len(new_pixels)): > spam += abs(original_pixels[i] - new_pixels[i]) > > return 1020 * len((original_pixels)) - spam Regarding this bit, try running Cython with the "--annotate" option. This will generate an HTML file from your code that shows where things are running in Python code (yellow) rather than C code (try a mouse click). 80 times faster sounds so slowish that there must still be type conversions involved. For example, have you imported "abs" from stdlib.h instead of using the Python builtin? And len() is a Python function, too, so you better use the size that you already know, rather than converting types between C and Python. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
