[fpc-devel] Case block binary search proposal

J. Gareth Moreton gareth at moreton-family.com
Sun Aug 5 15:38:15 CEST 2018


 Hi everyone,

 This one has been on my backburner for a while.  I spent the last few
days writing up some theory on the process, and feel this might be a good
optimisation for case blocks whose branches call identically-structured
functions, like in the peephole optimizer and the code formatter in Lazarus
(it hashes individual words then sends it through a large case block, where
a function then determines if it should be made bold or not).
 I've written up my notes on the Wiki over here:
http://wiki.freepascal.org/Case_Compiler_Optimization [1] - I hope it's
explained clearly enough, including the requirements.  At the moment I'm
not personally working on it because I have to finish my work on pure
functions.  Still, how does the proposal look?

 When I do write it, the peephole optimizer will be my main test case, as
it (currently) has 36 branches and I can test its speed and correctness
relatively easily.

 Gareth aka. Kit
  

Links:
------
[1] http://wiki.freepascal.org/Case_Compiler_Optimization
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180805/fe5c0834/attachment.html>


More information about the fpc-devel mailing list