Re: How to time the execution of a method?



"Robert Baker" <korax1214@xxxxxxxxx> wrote in message
news:ffrsh31jdatffuit1eqd78socd3s6pa6e3@xxxxxxxxxx
[...]
The problem is that I have three possible algorithms to [do something],
and I want to know which is the most efficient on average.
I've tried using the following:

function TimeMethod(x: TMethod): TDateTime;
var s,e: TDateTime;
begin
s:=Now;
x;
e:=Now;
TimeMethod:=86400*(e-s);
end;

ta:=TimeMethod(DrawA);
tb:=TimeMethod(DrawB);
tc:=TimeMethod(DrawC);

This doesn't work. Please advise.

Define "doesn't work". Then measure over doing it 10,000 times.

By the way, nice job with the procedural parameter. However, if
you start with a TDateTime and multiply it by 86,400, you no longer
have a TDateTime.

Groetjes,
Maarten Wiltink


.



Relevant Pages