[fpc-devel] static vs dynamic arrays

Peter Vreman peter at freepascal.org
Tue Apr 4 13:54:04 CEST 2006

>> No, it's a very common cases on all cpus which have a reasonable
>> amount of available registers.
> With 3-4 dynamical arrays and several parameters?
>> > What can I do to speed up dynamical arrays?
>> >
>> > What can I do to speed up static arrays?
> I mean: what is the shortest way to estimate speed?
> I don't know, why with "a[j]:=a[999999-j]"
> (yes, entering something other than 1000000 is likely to generate one
> exception or another, I did so to avoid processing array size as constant)
> static is faster and with "a[j]:=1" and "a[j]:=a[0] xor a[j]" dynamic is
> faster (this one is about 7719 vs 4405, dynamic wins!).

Use 2.1.1. Compile with "-O2 -al" and check the assembler output. It
depends on the application which variables are placed in a regiter and
which don't. This has been said already a couple of times. The register
allocator works already very efficient for common pratice so don't expect
any changes from the compiler itself. First do more expiriments and
research yourself, we've given you enough information do to.

More information about the fpc-devel mailing list