[fpc-devel] Circular references and forward declarations

Florian Klaempfl florian at freepascal.org
Wed Jan 6 13:36:28 CET 2010

Jonas Maebe schrieb:
> On 06 Jan 2010, at 13:04, Florian Klaempfl wrote:
>> Jonas Maebe schrieb:
>>> Another reason is probably to speed up the compilation:
>>> * (re)compiling huge source files can be slow and/or require lots of
>>> memory, depending on the used compiler (and debug information or
>>> optimization settings)
>> For single class c++ files, imo most of the time is spent into reading
>> the huge headers which are often even not needed and a complete mess
>> because nobody has an overview which classes are used and which not.
> It depends. Since these compilers only see whatever is in the current
> source file (and its header files), putting more code in the same source
> file can significantly slow down interprocedural optimizations (as soon
> as one algorithm with quadratic complexity is involved). And inlining
> can significantly increase the complexity of single routines as well,
> making stuff such as register allocation much slower :)

On the other hand keeping things in different files avoids these
optimizations. And being honest: I think using a debug switch set
without any optimization and with maximum checks and fast compilation
should be used for developer builds while wpo, inlining etc. is switched
on during relese builds.

More information about the fpc-devel mailing list