Re: String Functions
- From: "Pierre le Riche" <pleriche@xxxxxxxxxxx>
- Date: Sat, 30 Apr 2005 18:30:26 +0200
Hi John,
> The following IntToStr_JH1 function seems to be about
> 4 times faster than IntToStrPLR1 on small integers and
> about the same as IntToStrPLR1 on the largest integers.
I have serious doubts about the validity of that statement. How did you
measure it?
I just did a few tests on a P4:
With input values of +-maxint IntToStrPLR1 is 4.1 times faster.
With completely random integers IntToStrPLR1 is 3.7 times faster.
With integers < 10000 IntToStrPLR1 is about twice as fast.
With integers < 10 they are about the same.
Note that these times take into account the time used to generate the random
numbers and the loop traversal, so the actual difference is even greater.
Here is the benchmark code I used:
function GetTicks: Int64;
asm
rdtsc;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
ticks: Int64;
begin
ticks := getticks;
for i := 1 to 100000 do
begin
IntToStr_JH1(random(10000));
// IntToStrPLR1(random(10000));
end;
ticks := getticks - ticks;
label1.caption := inttostr(ticks div 1000);
end;
Regards,
Pierre
.
- Follow-Ups:
- Re: String Functions
- From: John Herbster
- Re: String Functions
- From: John Herbster
- Re: String Functions
- References:
- String Functions
- From: Chekcin
- Re: String Functions
- From: Dennis
- Re: String Functions
- From: Florent Ouchet
- Re: String Functions
- From: John Herbster
- String Functions
- Prev by Date: Re: Fastcode MM B&V 0.34
- Next by Date: Re: Fastcode MM Rule
- Previous by thread: Re: String Functions
- Next by thread: Re: String Functions
- Index(es):