If I do a calculation written in C, something like adding a matrix matrix or a matrix matrix, where the work is done in a loop forwith the same number and type of arithmetic operations performed at each iteration, can the specific values of the input data affect the speed of the calculation? For example, if the matrix elements are 32-bit integers with values from 0 to 127, so that their representations change only in one of every four corresponding bytes, it will work faster than if the values changed between 0 and INT_MAX(if the behavior is not executed undefined)?
If I had to guess, I would say no, because regardless of whether this value is small or very large, since it is defined as a 32-bit integer, it will be masked in the same amount of memory, small and large values will have the same amount of bytes in memory. Am I thinking about it right? Is this different for single / double precision floating point numbers?
source
share