According to the built-in help, Matlab calculates MOD (x, y) as:
MOD (x, y) = x - gender (x./y). * y
where the gender function is rounded to minus infinity (i.e. it splits the decimal part).
Runtime will be constant until you calculate mod (X, y), where X is a vector, in which case it will scale linearly with the number of elements in the vector
source share