[fpc-devel] x86_64 Optimizer Overhaul

J. Gareth Moreton gareth at moreton-family.com
Wed Dec 12 04:22:51 CET 2018


 It is indeed such a complex system.  I wouldn't say that I've identified
a bottleneck per se, but I've chosen to focus my improvements there.  The
idea behind the overhaul is that it attempts to reduce the number of passes
during the peephole optimizer stage - given that I've managed to shave off
15 seconds from the compile time of Lazarus, I figure I might be onto
something.

 Generally, a good place to start with bottlenecks are routines that are
most frequently entered, because any slow-downs there can very quickly
multiply.  For a recent example, I looked at OptPass1MOV and figure I
could refactor parts of it to reduce the number of calls to
"GetNextInstruction", which can take a while sometimes because it's
stepping through a linked list which might not always be cached. 
Otherwise it's a matter of simplifying some of the conditions.

 Otherwise, I'm the kind of perfectionist who just looks at a wall of
assembly language and thinks "that could be improved", even if it's just
one cycle.

 But the nice thing about open source projects like this is that we can all
have our individual specialisations and skillsets and choose to focus our
efforts on individual parts of the compiler.  If you ask me, if you see
something that could be improved, pass your ideas on and submit a patch if
you like.  It's worth doing some tests to confirm if you've made a saving,
although the hardest one to determine is if your compiled binary runs
faster or not.

 Gareth

 On Wed 12/12/18 03:51 , "Ryan Joseph" ryan at thealchemistguild.com sent:
 I’ve spent some time in the compiler sources now and I’m curious just
where people think the bottle necks for performance actually are. It’s
such a complicated system for anyone one person to have a good
understanding of so it’s not clear where to begin looking. 

 > On Dec 12, 2018, at 9:42 AM, J. Gareth Moreton  wrote: 
 > 
 > The overhaul primarily increases the speed of compilation, but it makes
some minor improvements to conditional branches here and there.
Nevertheless, I'm always happy to find a saving here and there in the
compiled assembly language! 

 Regards, 
 Ryan Joseph 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20181212/cabf26d3/attachment.html>


More information about the fpc-devel mailing list