[fpc-pascal] code optimization
Jonas Maebe
jonas.maebe at elis.ugent.be
Thu Sep 23 17:03:23 CEST 2010
On 23 Sep 2010, at 16:59, Adrian Veith wrote:
> I analyzed your code - I think the problem is the array element
> address
> calculation of the fpc compiler. You have a lot of code like
> Bar[MinValley] etc. The delphi compile uses the lea assembler code for
> this, whereas fpc calculates the address of one element with imul
> which
> is much slower.
Please see the last paragraph of http://lists.freepascal.org/lists/fpc-pascal/2010-September/026510.html
> Anyway you could speed up your code significantly if you
> help the compiler by reducing the address calculations with the help
> of
> pointers like this:
It may help a lot, but only because it will reduce register pressure,
not because the multiplications are gone.
Jonas
More information about the fpc-pascal
mailing list