i am looking for ways to test code speed.. or more precisely compare different piece of codes to see which is faster.
im aware of cpu cycles and the specific cycle for every opcode, but in real time this changes according to pairing, memory loads, stalls, and so on..

i know one method is gettickcount and another is rdtsc.
does anyone know of any other methods, or can show ways to implement the current ones.
and any other info you can give on the subject. thx.
Posted on 2004-11-01 20:01:31 by pwn
Posted on 2004-11-01 20:05:29 by comrade

You are right that real time testing is the only really reliable way to test algorithms and you have mentioned two methods of running real time tests. Generally the trick is to ensure that the test runs long enough to get past OS interference and produce results down around 1 or 2 percent.

The test design depends on what the algo is aimed at. If the algo has to handle a very large number of calls of relatively short data, you design a test that loops data to the algo at a high repetition rate.

If the algo is going to be used on very large data, you best time it by creating very large test pieces > 100 meg etc ...

The first is testing algo entry and exit speed as well as the algo code speed where the second mainly tests the speed of the procesing code.
Posted on 2004-11-01 20:16:08 by hutch--