[fpc-devel]Unexpected long compilation times when using multi-dimensional array
Peter Vreman
peter at freepascal.org
Mon Feb 4 09:09:51 CET 2002
> Hello,
>
> I have found some unexpected long compilation times with a multidimensional
> array. For the program below, compilation takes about eight minutes
> on a pentium III 533 Mhz, with 256 MB ram, running Linux. I'm using fpc
> 1.0.4 with the default options. [time fpc SimpleAssignment.p] I have found
> similar behaviour for the windows version.
>
> The data structure is used more often in a larger program I am working
> with, which leads to compilation times of over an hour.
>
> Is this a known 'feature' of the compiler or is there maybe an easy way
> to work around it?
Using gprof under linux reveils the problem is in retrieving the size of the array. This
is done recursively resulting in an huge amount of calls to the 3 routines below:
60.41 345.47 345.47 1073741808 0.00 0.00 _SYMTABLE$$_$$_TARRAYDEF_$$_SIZE
20.27 461.41 115.94 4294967277 0.00 0.00
_SYMTABLE$$_$$_TARRAYDEF_$$_ELESIZE
19.31 571.84 110.43 3221225478 0.00 0.00 _SYMTABLE$$_$$_TDEF_$$_SIZE
To solve this we need to add some kind of caching for the size of an arraydef.
More information about the fpc-devel
mailing list