<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Sounds fun. I'm currently working on a personal project to put
into my online Github in order to show off to prospective
employers, so it might be a while before I get around to that.</p>
<p>On another note, I'm also still waiting on Pierre to approve my
XML node dump, since he and I have been doing a kind of iterative
improvement with each patch we make. It's been about a week now
though since he's responded. I do hope that gets implemented soon
because using that to help implement pure functions will be very
useful. I have thought about another place where pure functions
in particular have an advantage when coupled with a smart compiler
- for example:</p>
<p><tt><b>for </b>X := 0 <b>to </b>Min(BUFFER_SIZE, DataLeft) <b>-
1 do</b></tt><tt><br>
</tt><b><tt>begin</tt></b><tt><br>
</tt><tt> { Do some work that doesn't modify DataLeft }</tt><tt><br>
</tt><tt><b>end</b>;</tt></p>
<p>Say that Min is given the <b>pure </b>directive, BUFFER_SIZE is
a <b>const </b>and DataLeft is a property or some non-local
variable. Since no volatile intrinsic is used to safeguard
multi-threading issues, and DataLeft isn't modified by the
for-loop, DataLeft can be promoted to the stack or a register.
Even though its exact value is not known, DataLeft is determined
to be constant within the confines of the for-loop, hence since
both arguments in "Min(BUFFER_SIZE, DataLeft)" are constants, the
result must also be constant, since it's a pure function,
therefore the function only has to be called once and its result
be stored on the stack, recalled during each iteration of the
for-loop. At least that's the theory. Of course, you can just
store the result yourself in a local variable and use that as part
of the for-loop, but it's just a thought where pure functions
could be used that doesn't involve computing their result at
compile-time.<br>
</p>
<p>Gareth aka. Kit</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 05/06/2019 16:11, Sven Barth via
fpc-devel wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAFMUeB9BTUyCp-CaM1qYCWGZWSefr9hkea2nGykd0Z4KE65mNQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="auto">
<div>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">J. Gareth Moreton <<a
href="mailto:gareth@moreton-family.com"
moz-do-not-send="true">gareth@moreton-family.com</a>>
schrieb am Mi., 5. Juni 2019, 14:52:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>Sounds fair. I would be trying for a refactoring
approach, in that the API and outward behaviour is
identical to before (i.e. a black box), but the inner
workings are better. I noticed that one potential
source of improvement is changing the Quicksort
algorithm, used in most of the sorting, for Introsort</p>
</div>
</blockquote>
</div>
</div>
<div dir="auto">You could try to adjust the FGL unit to use the
pluggable sorting system introduced here: <a
href="https://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&revision=41167"
moz-do-not-send="true">https://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&revision=41167</a></div>
<div dir="auto"><br>
</div>
<div dir="auto">It's currently only used for the non generic
TList and TFPList. </div>
<div dir="auto"><br>
</div>
<div dir="auto">You could then add a IntroSort implementation. </div>
<div dir="auto"><br>
</div>
<div dir="auto">Regards, </div>
<div dir="auto">Sven </div>
<div dir="auto">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
fpc-devel maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
</blockquote>
<div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br />
<table style="border-top: 1px solid #D3D4DE;">
<tr>
<td style="width: 55px; padding-top: 13px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
<td style="width: 470px; padding-top: 12px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>
</td>
</tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>