Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2002-02

Unexpected long compilation times when using multi-dimensional array

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

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?

Regards,

Cas

Cas Cremers

Student of computing science
Technical University of Eindhoven

//------------------------------------------
program SimpleAssignment;

{ 8m20s }

type
  B = Boolean;
  T = array [ B, B, B, B, B,
              B, B, B, B, B,
              B, B, B, B, B
            ] of Integer;

procedure Init ( var a: T; c: Integer );

  begin
  a [ True, True, True, True, True,
      True, True, True, True, True,
      True, True, True, True, True
    ] := c
  end; { Init }
var
  a: T;
begin
  Init ( a, 0 )
end.
//------------------------------------------

Reply by email

Peter Vreman
Show quoted text 13 lines
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.

Reply by email

Jonas Maebe
to Peter Vreman
Peter Vreman wrote 14 lines
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.

Done. I didn't know it was also posted on the mailing list, I had only seen it on the web board.

Jonas

Reply by email

Unknown author
to Jonas Maebe
> To solve this we need to add some kind of caching for the size of an > arraydef. Done.

Thanks very much for the fast response and solution! I will be testing the new version this afternoon.

I didn't know it was also posted on the mailing list, I had only seen it on the web board.

My apologies. But as the board was down sunday evening, I wasn't sure wether it was still being used.

Cas

Disclaimer: Cas's family and friends have tried to keep him from stating the above, but he persisted.

Reply by email

Jonas Maebe
to Unknown author
Show quoted text 8 lines
>> To solve this we need to add some kind of caching for the size of an >> arraydef. > > Done. Thanks very much for the fast response and solution! I will be testing the new version this afternoon.

That won't be possible, unless you checkout the sources from CVS and recompile the compiler yourself. Since I submitted the fixes today, they will appear in tomorrow's snapshot.

My apologies. But as the board was down sunday evening, I wasn't sure wether it was still being used.

No problem. I just wanted to explain why I sent you a personal email about it too.

Jonas

Reply by email