The real question is "What do you want to know the time for?"
If you are trying to find out how long your code will take in the real
world, you need the average and longest times (to get typical and worst case
results)
If you are trying to compare algorithms, as has already been pointed out,
you need only at most 6 test cases (for black box testing), in the case of
Jon's code there are only 4 paths (white box testing), so you could run only
4 tests (but use two of them twice to get 6 results).
For each test case, use the SAME 3 numbers (1,2,3), (2,1,3), etc for a large
enough number of repetitions to get a usable result.
This tells you the worst case (for 2 cmp, 1 mov, 2 jmp in this case), and
since you can probably assume equal probabilities, a simple average of the
SIX test case results will give you the typical.

I can't see what use the smallest time is to you (since you can't make it
happen every time without already knowing the result!)

Regards,
Ken


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of CubicDesign
Sent: 29 August 2007 10:59
To: Borland's Delphi Discussion List
Subject: Re: maximum of 3 numbers

Hi Jon,

You function returns the best time.

Still I wonder if I should make and average of all times or to look only 
for the smallest time.
I think I should look for the smallest time.


_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to