I see. That indeed could explain that 96usec delay between ISRs. But in the first code, since i expected that Serial.print could be somehow affecting the ISR, i used the 2 variables "now" and "previous" before calling Serial.print, so actual measurements of elapsed time shouldn't be affected by that.
Still with the first method i get different results. I guess the result 24 is ok, but why 12 and 20? 12 (or 20) usecs would mean a much higher frequency, while i've set it at 40KHz and that should be around 25usecs.
Declare an array of values, and in the ISR, put the calculated value into the array and increment the index.
After the index gets up to some pre-determined value, print out the contents of the array.
Thank you for all those nice replies.
I've tried both making my serial transmission faster, and using an array and i do get much better results now : mostly 24 and some 28 now and then.
And coolest of all: thanks to leppie i've discovered ISR_NOBLOCK. It won't really help me in calculating the speed (looks like the ISR is fast enough to end before another one begins, as i get the same results) but it will help me a lot for my lasertag project.
Thanks to all your answers i was able to complete my code snippet for sending IR remote codes in background which you can find here: Arduino Playground - MultiIR