Hi Ken > The real question is "What do you want to know the time for?"
I made a program that is functional but is not optimized for speed. I will not add many features for a while; instead, I want to improve its speed. This is why I need to make speed tests of misc. procedures and functions. > 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!) What is the main problem when measuring the time? Big variations! For a speed test, (I think) that the ideal condition is the code running ALONE in a CPU. Setting process' priority to critical takes the test somehow near to that condition. Basically, I get variations because other processes interfere with my test. Right? So, recording the smallest time means that I measure the time when the code executed close to ideal conditions. > 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. > > > > 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 > _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

