I am very surprised that its that fast, just to be sure, do you mean milliseconds or clock pulses ?
clockpulses... This is the code i used :
TCCR1B &= 0xF8;
TCCR1B |= (1 << CS10);
float fnumber1, fnumber2;
volatile float fresult = 0.0;
unsigned long total;
for (int i = 0; i < 10000; i++)
fnumber1 = random() / 1000.0;
fnumber2 = random() / 1000.0;
TCNT1 = 0;
fresult = fnumber1 / fnumber2;
time = TCNT1;
total += time;
total /= 10000;
Serial.print(" / ");
Serial.print(" = ");
Which all goes to show what a nonsense measuring the performance and optimization of contrived sequences of code is.
If you have a real application - then it gets interesting.
Agree with you unless your goal is to learn about optimizations and how they are done. (there is always that other option
Well, disabling optimizations can be useful to compare floating point operations versus integer operations. The whole point of this exercise was to know - before i have a complete project - if the arduino will be fast enough and if i will be able to use floating points or if I will have to do all the calculations with integers.
But in the end... these measurements will indeed be estimates and real measurements can only be taken in real programs. I totally agree with that statement.
Thanks to everybody for this very informative discussion.