[fpc-devel] FPC/Lazarus Rebuild performance

Adem listmember at letterboxes.org
Fri Sep 10 17:43:59 CEST 2010


Sometime ago, there was a brief mention of multi-threading FPC would be 
counter productive because compilation process was mostly disk IO bound 
--this is what I understood anyway.

I wanted to check to see if disk IO was really limiting FPC/Lazarus 
compile performance.

The only quick way I could devise to check this was to use two different 
disks which are significantly different from one another in terms of 
performance.

And, to help with timing, I modified the mnuToolBuildLazarusClicked() 
event (in \lazarus\ide\main.pp). [See below for code.]

Here is test setup:

OS: Win7, x64, 8 GB RAM.
Disk1: SSD, OCZ Vertex, NTFS
Disk2: RAMDisk, Dataram, NTFS [ 
http://memory.dataram.com/products-and-services/software/ramdisk ]

To show that these disks perform significantly differently from one 
another, I used 'ATTO Disk Benchmark' (default settings) and took the 
max values for each disk.

SSD: Read:   200 MB/s Write:   198 MB/s
RAMDisk: Read: 2,227 MB/s Write: 1,545 MB/s

IOW, RAMDisk is between 8 and 11 times faster than the SSD --significant 
enough for my purposes.

I used this version of Lazarus: lazarus-0.9.28.2-fpc-2.2.4-win64.exe

Identical copies of (default setup of) Lazarus on both disks.
Nothing, other than the relevant paths altered by me.

Testing:

Rebuild Lazarus 10 times on each disk. Here are the values:

SSD:

01: 105,498 ms
02: 103,678 ms
03: 103,345 ms
04: 101,522 ms
05: 104,720 ms
06: 101,874 ms
07: 100,136 ms
08: 100,492 ms
09: 104,850 ms
10: 104,488 ms

RAMDisk:

01: 101,150 ms
02: 111,198 ms
03: 109,066 ms
04: 103,516 ms
05: 105,875 ms
06: 103,133 ms
07: 104,036 ms
08: 108,763 ms
09: 104,306 ms
10: 103,583 ms

Here are the average values:

     SSD: 103,060 ms (1 min 43 sec)
RAMDisk: 105,463 ms (1 min 46 sec)

This doesn't make sense. FPC/Lazarus compiles on the faster medium 
longer (albeit only 3 sec.).

But, more than that, I can't see how FPC/Lazarus would be disk IO bound, 
if it takes practically the same time on a medium that is 8-11 times 
faster than the other one.

While doing the builds, I kept an eye on the other parameters too. This 
is an 8-core machine, and never during this test did any core hit 
anything beyond %20. Same with paging.. It practically stayed the same.

If it isn't disk IO, if it isn't CPU load; then what is it?

RAM IO bound?

Could it be?

--------------------------------------------------------------
here is modified code:
--------------------------------------------------------------

procedure TMainIDE.mnuToolBuildLazarusClicked(Sender: TObject);
var
     StartTime1: TDateTime;
     EndTime1: TDateTime;
     Path1: String;
     Times1: TStringList;
   DoTime1: Boolean;
   MilliSecs1: Int64;
begin
     if MiscellaneousOptions.BuildLazOpts.ConfirmBuild then
       if MessageDlg(lisConfirmLazarusRebuild, mtConfirmation, mbYesNo, 
0)<>mrYes then exit;
   DoTime1 := MessageDlg('Do you also want to time the build process', 
mtConfirmation, mbYesNo, 0) = mrYes;

   if DoTime1 then begin
        Times1:= TStringList.Create;
        StartTime1 := Now();
   end;

   try
     DoBuildLazarus([]);
   finally
     if DoTime1 then begin
         EndTime1 := Now();
         Path1 := 
IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName)) + 
'BuildTime.txt';
         MilliSecs1 := MilliSecondsBetween(StartTime1, EndTime1);
         if FileExists(Path1) then Times1.LoadFromFile(Path1);
           Times1.Add(IntToStr(MilliSecs1));
           Times1.SaveToFile(Path1);
           Times1.Free;
     end;
   end;
end;



More information about the fpc-devel mailing list