[fpc-devel] Fwd: Re: An optimization suggestion for FPC

J. Gareth Moreton gareth at moreton-family.com
Mon Jul 13 12:23:16 CEST 2020


Hi Jonas,

I've made a patch that hopefully should optimise the situation where the 
record type contains only one field, following the tips you gave me 
regarding the "has_single_field()" method.

https://bugs.freepascal.org/view.php?id=37343

I haven't been able to test it as rigorously as I would have liked.  I'm 
having some difficulty compiling projects under Lazarus with the trunk 
since it tries to recompile windows.ppu due to a checksum mismatch, and 
immediately fails upon not being able to find a file.  I might have some 
configuation problems, because when I try to compile the test program 
directly from the command line, it just hangs when I run it (even 
without the patch applied), and there's nothing in the code that should 
cause an infinite loop.  I can, however, analyse the disassembly and see 
that the optimisation has indeed been applied correctly.

Gareth aka. Kit

On 28/06/2020 14:18, Jonas Maebe wrote:
> On 28/06/2020 14:18, J. Gareth Moreton wrote:
>> Thanks Jonas.  I'll see what I can put together.  A record with a single
>> field is a bit of a special case, but one I'll keep in mind.  More than
>> anything I'll have to study the disassembly to see what's happening, and
>> if things are faster with primitive types simply because they're
>> register variables (which are always faster than stack variables even on
>> L1) or due to something else.
> This issue is not register versus memory, it's "register + a bunch of
> masking and inserting" versus memory, plus the code size overhead (which
> will probably not have any noticeable effects in a small benchmark).
>
>
> Jonas
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>

-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the fpc-devel mailing list