Re: String Functions



what about GetCpuClockCycleCount ?

"John Herbster" <herb-sci1_AT_sbcglobal.net> wrote in message
news:4273cc1a$1@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> 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;
>


.


Quantcast