Re: String Functions
- From: "John Herbster" <herb-sci1_AT_sbcglobal.net>
- Date: Sat, 30 Apr 2005 13:22:36 -0500
Here is a modification of Pierre's test program.
It stores the results in an array and allows setting
the NbrRepeats and the Random modulus. I see
a lot of time be consumed in memory allocation.
Note that the program requires:
Button Button1
Edit boxes NbrRepeats_e and RandMod_e
Memo box Memo1 for results.
--JohnH
procedure TForm1.Button1Click(Sender: TObject);
var NbrRepeats, RandMod, i, n: integer; t0,t1,ticks: Int64;
TicksPerConv: double; s: string;
Results: array [1 .. 100000] of string;
begin
NbrRepeats := StrToInt(NbrRepeats_e.Text);
RandMod := StrToInt(RandMod_e.Text);
Memo1.Lines.Add(Format('With %D repeats with
random(%D)',[NbrRepeats,RandMod]));
ticks := 0;
for i := 1 to NbrRepeats do
begin
n := random(RandMod);
t0 := GetCpuClockCycleCount;
Results[i] := IntToStrPLR1(n);
t1 := GetCpuClockCycleCount;
ticks := ticks + (t1 - t0);
end;
TicksPerConv := ticks/NbrRepeats;
Memo1.Lines.Add(Format('%0.0F IntToStrPLR1
%S',[TicksPerConv,Results[1]]));
ticks := 0;
for i := 1 to NbrRepeats do
begin
n := random(RandMod);
t0 := GetCpuClockCycleCount;
Results[i] := IntToStr_JH1(n);
t1 := GetCpuClockCycleCount;
ticks := ticks + (t1 - t0);
end;
TicksPerConv := ticks/NbrRepeats;
Memo1.Lines.Add(Format('%0.0F IntToStr_JH1
%S',[TicksPerConv,Results[1]]));
ticks := 0;
for i := 1 to NbrRepeats do
begin
n := random(RandMod);
t0 := GetCpuClockCycleCount;
Results[i] := IntToStrPLR1(n);
t1 := GetCpuClockCycleCount;
ticks := ticks + (t1 - t0);
end;
TicksPerConv := ticks/NbrRepeats;
Memo1.Lines.Add(Format('%0.0F IntToStrPLR1
%S',[TicksPerConv,Results[1]]));
ticks := 0;
for i := 1 to NbrRepeats do
begin
n := random(RandMod);
t0 := GetCpuClockCycleCount;
Results[i] := IntToStr_JH1(n);
t1 := GetCpuClockCycleCount;
ticks := ticks + (t1 - t0);
end;
TicksPerConv := ticks/NbrRepeats;
Memo1.Lines.Add(Format('%0.0F IntToStr_JH1
%S',[TicksPerConv,Results[1]]));
end;
.
- Follow-Ups:
- Re: String Functions
- From: Pierre le Riche
- Re: String Functions
- From: ffz
- 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
- Re: String Functions
- From: Pierre le Riche
- String Functions
- Prev by Date: Re: String Functions
- Next by Date: Re: String Functions
- Previous by thread: Re: String Functions
- Next by thread: Re: String Functions
- Index(es):