• Subject: Re: How are CPU Speed and Overall CPW Related?
  • From: "Nathan M. Andelin" <nathanma@xxxxxxxxx>
  • Date: Thu, 3 May 2001 11:25:11 -0600

> From: "Alexei Pytel" <pytel@us.ibm.com>

> I can't understand your obsession with "artificial constraints".
> It's much more complicated than that.

I'll try to address your comments in a future post, but while I have your
attention, I'll add a little more fuel to the fire.  Foxpro is an
interpreted language, and relatively slow.  So what about a compiled
language like Pascal?  Consider the following Delphi code:

procedure TForm1.Button1Click(Sender: TObject);
var
  theString : String;
  theShorter : String;
  i : integer;
  timeNow : TDateTime;
  timeThen : TDateTime;
  timeDiff : Real;

begin
  theShorter := 'TEST STRING                                        ';
  timeThen := Now;
  for i := 0 to 500000 do
  begin
   theString := TrimAll(theShorter);
  end;
  timeNow := Now;
  timeDiff := timeNow - timeThen;
  stringBox.text := theString;
  timeBox.text := FloatToStr(timeDiff);
end;


***
My older version of Delphi didn't have a TrimAll() function.  I had to write
my own BIF:
***


function TrimAll(const S: string): string;
var
  I, L: Integer;
begin
  L := Length(S);
  I := 1;
  while (I <= L) and (S[I] < #33) do Inc(I);
  if I > L then Result := '' else
  begin
    while (S[L] < #33) do Dec(L);
    Result := Copy(S, I, L - I + 1);
  end;
end;

Like the RPG code, this program TRIMS all BLANKS off a 50 byte
string and assigns the result to another string variable.  The difference
is that the Intel based Pascal program runs 10 times faster.

What is constraining the AS/400 CPU?

Nathan.



+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.