Re: String Functions




> > I just tried yours John and it seems like its about
> > 4x slower than Pierre's in most cases? Anyone
> > else confirm this? On an AthlonXP 2500+ and D7

"Pierre le Riche" <pleriche@xxxxxxxxxxx> wrote

> I can confirm your findings on a P4.

Here is my test program and some results under
D5 and D7. The results seem about the same with
optimization $O+ and $O-.

procedure TForm1.T_IntToStr_bClick(Sender: TObject);
var c,d: int64; i: integer; s: string;
const a,b: bytes;
begin
i := 1;
c := GetCpuClockCycleCount;
s := IntToStr(i);
d := GetCpuClockCycleCount - c;
Memo1.Lines.Add(Format(' %D IntToStr %S',[d,s]));
c := GetCpuClockCycleCount;
s := IntToStrPLR1(i);
d := GetCpuClockCycleCount - c;
Memo1.Lines.Add(Format(' %D IntToStrPLR1 %S',[d,s]));
c := GetCpuClockCycleCount;
s := IntToStr_JH1(i);
d := GetCpuClockCycleCount - c;
Memo1.Lines.Add(Format(' %D IntToStr_JH1 %S',[d,s]));
end;


Win2K, SP4, D5, Athlon ~1.5GHz
TSC Routine Number

8800 IntToStr 1
3424 IntToStrPLR1 1
1270 IntToStr_JH1 1

8697 IntToStr 1
3529 IntToStrPLR1 1
963 IntToStr_JH1 1

8870 IntToStr -123456789
1936 IntToStrPLR1 -123456789
1866 IntToStr_JH1 -123456789

8753 IntToStr -123456789
2332 IntToStrPLR1 -123456789
1896 IntToStr_JH1 -123456789

(Win2K, SP4, D7, Athlon ~1.5GHz)
TSC Routine Number

7810 IntToStr 1
3832 IntToStrPLR1 1
1392 IntToStr_JH1 1

7877 IntToStr 1
3941 IntToStrPLR1 1
1074 IntToStr_JH1 1

8202 IntToStr -123456789
2032 IntToStrPLR1 -123456789
2018 IntToStr_JH1 -123456789

8443 IntToStr -123456789
1793 IntToStrPLR1 -123456789
1839 IntToStr_JH1 -123456789


.