Recent

Author Topic: RTL rebuild optimization  (Read 3126 times)

avra

  • Hero Member
  • *****
  • Posts: 2234
    • Additional info
RTL rebuild optimization
« 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.
« Last Edit: July 13, 2021, 01:52:50 pm by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9542
  • FPC developer.
Re: RTL rebuild optimization
« Reply #1 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.

avra

  • Hero Member
  • *****
  • Posts: 2234
    • Additional info
Re: RTL rebuild optimization
« Reply #2 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!
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 902
Re: RTL rebuild optimization
« Reply #3 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

avra

  • Hero Member
  • *****
  • Posts: 2234
    • Additional info
Re: RTL rebuild optimization
« Reply #4 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
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

avra

  • Hero Member
  • *****
  • Posts: 2234
    • Additional info
Re: RTL rebuild optimization
« Reply #5 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
« Last Edit: July 14, 2021, 08:46:33 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

avra

  • Hero Member
  • *****
  • Posts: 2234
    • Additional info
Re: RTL rebuild optimization
« Reply #6 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  ;)
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

 

TinyPortal © 2005-2018