[Lazarus] Timing of all compiler options on slow machines

Sven Barth pascaldragon at googlemail.com
Thu Aug 22 13:42:10 CEST 2013


Am 21.08.2013 17:45, schrieb Sven Barth:
> Maybe I'll need to test this on my mobile development computer as well 
> (800 MHz Intel Stealy processor, 1 GB RAM, Windows 7) ^^
I've written a simple application that uses TProcess to start "fpc -i" 
and "fpc -h" and reads it standard and error output. The "fpc" 
executable can be passed as parameter.

On my above mentioned 800 MHz system "fpc -i" takes ~445ms and "fpc -h" 
~540ms for a 2.6.2 fpc.exe. If I now use a 2.6.2 ppc386.exe (which is 
called by fpc.exe) the time is ~240ms and ~315ms respectively.

I've attached the lpr if someone wants to test him-/herself.

Regards,
Sven
-------------- next part --------------
program processtest;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  SysUtils
  { you can add units after this }, process;

procedure ExecuteProcess(const aExecutable: String;
  const aArgs: array of String);
var
  p: TProcess;
  s: String;
  buf: array[0..1023] of Byte;
  start: TDateTime;
begin
  p := TProcess.Create(Nil);
  try
    p.Executable := aExecutable;
    for s in aArgs do
      p.Parameters.Add(s);
    p.Options := [poUsePipes];
    start := Now;
    p.Execute;
    while p.Running do begin
      if p.Stderr.NumBytesAvailable > 0 then
        p.Stderr.Read(buf, Length(buf));
      if p.Output.NumBytesAvailable > 0 then
        p.Output.Read(buf, Length(buf));
    end;
    while p.StdErr.NumBytesAvailable > 0 do
      p.Stderr.Read(buf, Length(buf));
    while p.Output.NumBytesAvailable > 0 do
      p.Output.Read(buf, Length(buf));
    Writeln('Duration: ', FormatDateTime('hh:nn:ss.zzz', Now - start));
  finally
    p.Free;
  end;
end;

var
  exe: String;
begin
  if ParamCount = 0 then
    exe := 'fpc'
  else
    exe := ParamStr(1);
  ExecuteProcess(exe, ['-i']);
  ExecuteProcess(exe, ['-h']);
end.



More information about the Lazarus mailing list