Recent

Author Topic: Why are some units re-compiled?  (Read 1351 times)

jollytall

  • Sr. Member
  • ****
  • Posts: 377
Why are some units re-compiled?
« on: March 03, 2022, 07:09:06 am »
I am using Lazarus and compile the projects with F9, or Ctrl-F9. Normally when I compile a project only those units are re-compiled that have been changed. This is logic.
Sometimes I notice (this time with generics.collections) that a unit is re-compiled when the unit itself is not changed, but where it is in the uses changes. So, when I make a small change in my unit then the whole generics.collections is re-compiled slowing down the compilation (and btw. also throwing hints, warnings and notes).
Why is this?

WooBean

  • Sr. Member
  • ****
  • Posts: 301
Re: Why are some units re-compiled?
« Reply #1 on: March 03, 2022, 08:05:34 am »
Hi,

IMO when some unit or program changes its "uses" clause (including other unit) then its environment (compiler directives and application settings) must apply to unit which has not changed itself but generated code (unit.ppu, unit.o) will be different according to global settings. That is why.
Platforms: Win7/64, Linux Mint 22.1 Xia

PascalDragon

  • Hero Member
  • *****
  • Posts: 6315
  • Compiler Developer
Re: Why are some units re-compiled?
« Reply #2 on: March 03, 2022, 09:02:45 am »
Sometimes I notice (this time with generics.collections) that a unit is re-compiled when the unit itself is not changed, but where it is in the uses changes. So, when I make a small change in my unit then the whole generics.collections is re-compiled slowing down the compilation (and btw. also throwing hints, warnings and notes).
Why is this?

This is not Generics.Collections being recompiled, but the generics that you use from that unit (aka the specializations) inside your own unit being recompiled. And when a generic generates a warning, hint, etc. then this will also be repeated during the specialization.

jollytall

  • Sr. Member
  • ****
  • Posts: 377
Re: Why are some units re-compiled?
« Reply #3 on: March 03, 2022, 10:50:10 am »
I see, thanks.

 

TinyPortal © 2005-2018