"Luca Béla Palkovics" <luca.bela.palkovics@xxxxxxxxx> writes: > Am Sonntag, den 09.05.2010, 21:49 -0700 schrieb Ian Lance Taylor: >> Some possibilities are: >> >> 1) Measurement error. Surprisingly often people are not measuring >> what they think they are measuring, and you didn't provide any >> details about how you got your timings. > function is extern "C" and I messure the time outside. > > long start=GetTime(); //own function using gettimeofday (returns ms) > A(); > long time=GetTime()-start; > //Output time.. > > So shold be correct.. Using gettimeofday means that the measurements are highly sensitive to any other load on the machine. To get measurements this way, you must at the very least run the function many times in a loop, and you need an outer loop to test first one function then the other. Then you need to average all the results. If you are interested in how much CPU time the functions require, using the clock function will be more accurate. However, clock can be misleading if the functions make any system calls. Ian