Lazarus

Free Pascal => FPC development => Topic started by: avra on July 13, 2021, 01:48:41 pm

Title: RTL rebuild optimization
Post by: avra on July 13, 2021, 01:48:41 pm
I have used fpcupdeluxe to download trunks of FPC and LAZ into c:/Prg/Lazarus/TrunkAll.

For testing purpose I have made a small RTL change to sysutils.pp and used these to recompile RTL:
Quote
c:\Prg\Lazarus\TrunkAll\fpcsrc> c:\Prg\Lazarus\fpc.3.2.2\bin\i386-win32\make.exe clean distclean
c:\Prg\Lazarus\TrunkAll\fpcsrc> c:\Prg\Lazarus\fpc.3.2.2\bin\i386-win32\make.exe all
c:\Prg\Lazarus\TrunkAll\fpcsrc> c:\Prg\Lazarus\fpc.3.2.2\bin\i386-win32\make.exe install INSTALL_PREFIX=c:\Prg\Lazarus\TrunkAll\fpc

My test project which uses that small RTL change compiles from both command line and Lazarus, and Lazarus can rebuild (if needed) without problems. Everything works fine but takes time.

The question is (since I am going to do this a lot), is there a way to speed this up? Is it safe to avoid make clean distclean, and do I really need full make all? I will only change several sub files of sysutils.
Title: Re: RTL rebuild optimization
Post by: marcov on July 13, 2021, 01:52:28 pm
Only if your programs don't depend on units that depend on sysutils.

I do this a lot when debugging package chm, just recompile and move it over the old units. But few units depend on units in package CHM (only lhelp, but that can be kept as exe without recompilation).

So in short: yes, you can, but for a core unit as sysutils this is pretty useless.
Title: Re: RTL rebuild optimization
Post by: avra on July 13, 2021, 01:58:58 pm
So in short: yes, you can, but for a core unit as sysutils this is pretty useless.
I was afraid that would be the case.

Thanks!
Title: Re: RTL rebuild optimization
Post by: Jonas Maebe on July 13, 2021, 06:49:48 pm
You can just use distclean, it already includes clean.

You can add the following options to make to speed it up: -j X FPMAKEOPT="-T X", with X = the number of parallel processes to use
Title: Re: RTL rebuild optimization
Post by: avra on July 13, 2021, 10:28:17 pm
You can just use distclean, it already includes clean.
Thanks!

You can add the following options to make to speed it up: -j X FPMAKEOPT="-T X", with X = the number of parallel processes to use
You nailed it. That was going to be my next search/question, but didn't have a chance with such mind reading devs.  :D 8-) :D
Title: Re: RTL rebuild optimization
Post by: avra on July 14, 2021, 08:22:07 am
Initial FPC rebuild time on XEON W-2125 with 4 cores and 8 threads on M.2 SSD was 6 minutes and 55 seconds.
Removing clean reduced it to 6 minutes and 0 seconds.
Adding 8 threads reduced it further to 4 minutes and 15 seconds.

Much nicer. Thanks!  :D ::) :D
Title: Re: RTL rebuild optimization
Post by: avra on July 14, 2021, 09:05:24 am
I've lost much more time then I liked in finding such basic info, so I have created a wiki page with rebuild automation script:
https://wiki.freepascal.org/FPC_recompilation_automation

Hope it helps someone  ;)
TinyPortal © 2005-2018