Re: How to time the execution of a method?
- From: "Nurax" <nurax@xxxxxxxxxxxxxx>
- Date: Wed, 24 Oct 2007 11:56:16 +0200
The problem is that I have three possible algorithms to re-inflate the
screen, 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;
Maybe x is too fast to time;
Try this:
function TimeMethod(x: TMethod): string;
var i, t, tot: Cardinal;
begin
tot := 0;
for i := 1 to 1000 do
begin
t := GetTickCount;
x;
Inc(tot, GetTickCount - t);
end;
result := FormatFloat('Seconds: 0.0000', tot/1000);
end;
.
- Follow-Ups:
- Re: How to time the execution of a method?
- From: Maarten Wiltink
- Re: How to time the execution of a method?
- References:
- How to time the execution of a method?
- From: Robert Baker
- How to time the execution of a method?
- Prev by Date: table does not exist
- Next by Date: Re: How to time the execution of a method?
- Previous by thread: Re: How to time the execution of a method?
- Next by thread: Re: How to time the execution of a method?
- Index(es):
Relevant Pages
|