[fpc-devel] LEA instruction speed

Tomas Hajny XHajT03 at hajny.biz
Tue Oct 10 12:54:24 CEST 2023


On 2023-10-10 12:19, Marco van de Voort via fpc-devel wrote:
> Op 10-10-2023 om 11:13 schreef J. Gareth Moreton via fpc-devel:
>> 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.
>> 
> I had the same problem, and now it is stable  Ryzen 5700X (ZEN3)
> 
>    Pascal control case: 0.7 ns/call
>  Using LEA instruction: 0.4 ns/call
> Using ADD instructions: 0.7 ns/call

Indeed, it's much more consistent now, attached a new log for both 
32-bit and 64-bit versions from the Intel machine with Windows. 
Apparently, ADD is still somewhat faster on such "newer" Intel machines 
(at least if not considering the potential parallelism of LEA discussed 
previously). I can try this version on my AMD machines later tonight if 
considered useful - please, let me know which results would be relevant 
for you in that case (out of the ancient AMD DX4, only slightly less 
ancient AMD Athlon 1 GHz and the still rather reasonable AMD A9).

Tomas
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: blea2.txt
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20231010/dc4b7242/attachment.txt>


More information about the fpc-devel mailing list