[fpc-devel] LEA instruction speed

Christo Crause christo.crause at gmail.com
Wed Oct 11 06:56:09 CEST 2023


On Tue, Oct 10, 2023 at 11:13 AM J. Gareth Moreton via fpc-devel
<fpc-devel at lists.freepascal.org> wrote:
>
> Thanks Tomas,
>
> Nothing is broken, but the timing measurement isn't precise enough.
>
> Normally I have a much higher iteration count (e.g. 1,000,000), but I
> had reduced it to 10,000 because, coupled with the 1,000 iterations in
> the subroutines themselves, would have led to 1,000,000,000 passes and
> hence would take in the region of five to ten minutes to complete for a
> 16 MHz 386, for example.  Rika's suggestion of running as many
> iterations as needed until, say, 5 seconds elapses, would help but the
> timing measurements would cause a lot of latency and will be imprecise
> on very slow routines.  Still, let's see if 100,000 gives better results
> for you.
>
> Kit

Results on a modest CPU:

CPU =       Intel(R) Celeron(R) CPU  N3050  @ 1.60GHz
-----------------------------------------------------
   Pascal control case: 6.71 ns/call
 Using LEA instruction: 2.09 ns/call
Using ADD instructions: 2.05 ns/call

32 bits:
   Pascal control case: 6.78 ns/call
 Using LEA instruction: 2.16 ns/call
Using ADD instructions: 2.09 ns/call

Results show a bit of variance, above numbers are more or less typical.

Christo


More information about the fpc-devel mailing list