Just for info, I tested several data types.
app. execution time in us for one oparation incl. write to RAM (var's are volatile)
Operator + - * / %
byte 0,41 0,60 5,4
char (signed) 0,41 0,60 15,2
unsigned int (range byte) 0,85 1,35 13,1
unsigned int (full range) 0,85 1,35 13,2
int (range short int) 0,85 1,35 15,2
int (full range) 0,85 1,35 15,2
unsigned long 1,7 6,1 43,6
long 1,7 6,1 44,7
float 6,5 9,8 28,9
void loop() {
volatile char x, a, b, min, max; // forces x to be in RAM, not in registers (as in every normal code)
min = -127;
max = 127;
time1 = micros(); // reference time
for (unsigned int i = 0; i < 10000; i++) {
a = random(min, max);
b = random(min, max);
asm(""); // avoid code optimization of the compiler
}
time1 = micros() - time1;
time2 = micros();
for (unsigned int i = 0; i < 10000; i++) {
a = random(min, max);
b = random(min, max);
x = a/b;
asm(""); // avoid code optimization of the compiler
}
time2 = micros() - time2;
Serial.print("Completion time: ");
Serial.print((time2-time1)/10);
Serial.println("ns per operation");
}