Double vs Integer operation time

I’ve written a Gaussian filter function that filters a 32 x 32 matrix using a 9 x 9 kernel taking 150ms to execute.

Currently I’m using doubles, would there be a significant improvement in execution time if I was to use integers throughout instead?


I had an algorithm on the stm32f2xx that used heavy doubles, converting them to single precision float helped but it still took 17 ms. I then ran the code on a stm32f4xx with floating point and it took less than 1 ms to execute. The stm32f4xx was running at the same clock speed.

1 Like

Also adding an f to your constants can force them to single precision.

Example: 3.14 is single precision.

Functions like abs can also be forced to single precision by calling fabs instead.