[fpc-devel] static vs dynamic arrays

Пётр Косаревский ppkk at mail.ru
Tue Apr 4 13:12:38 CEST 2006


Something new at the end of message.

> >> They are equally fast if you turn on register variables and if enough
> >> free registers are available (e.g. on a PPC; possibly also on an x86
> >> if you have a very simple loop and little or no variables used both
> >> before and after the loop).
> > It's wrong.
> 
> bigmac:~/fpc/test jonas$ ppcppc69 -O3 tarr
> Target OS: Darwin for PowerPC
> Compiling tarr.pp
> Assembling testdynstat
> Linking tarr
> 43 Lines compiled, 0.3 sec
> bigmac:~/fpc/test jonas$ ./tarr
> Enter dyn array len (1-1000000):1000000
> Total:4789ms
> Total:4809ms
> bigmac:~/fpc/test jonas$ ./tarr
> Enter dyn array len (1-1000000):1000000
> Total:4897ms
> Total:4787ms

Wow!
I'm glad for PowerPC, but anyhow: (formatted)
3954   4234
4000   4266
3938   4234
3890   4281
3907   4218
I repeat, celeron 2.4 GHz, winxpsp2.

In real program registers should be used more efficiently, especially when dealing with SEVERAL arrays, than for support of ONE dynamical array.
So, the circumstances described by you can only be reached in special cases.

I don't mean to blame/flame or something, I just ask (in developers' mail list):

What can I do to speed up dynamical arrays?

What can I do to speed up static arrays?



NOW: the argument contra static arrays --- almost the same program, but "a[j]:=1" and "b[j]:=1" inside cycles, formatted output:
6641    3952
6655    3970
6610    3938
(I have already roughly specified my system, "fpc -O3rp4 222.pp")



More information about the fpc-devel mailing list