<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I put a global counter in the conditional part of Trees, and indeed it reveals that this part is entered only 2 times of the 10 calls, as you predicted.<div class=""><br class=""></div><div class="">It's interesting that the "reference output" of Trees is the first ten integers shown here:</div><div class=""><a href="https://github.com/microsoft/test-suite/blob/master/SingleSource/Benchmarks/Stanford/Treesort.reference_output" class="">https://github.com/microsoft/test-suite/blob/master/SingleSource/Benchmarks/Stanford/Treesort.reference_output</a></div><div class=""><br class=""></div><div class="">giving at least me the illusion that the Tree benchmark was run correctly 10 times. </div><div class=""><br class=""></div><div class="">Now that I look more carefully this is just an illusion, because this "reference output" is reusing the global array sortlist, which is the list of unsorted integers and which is left unchanged after each run of Trees. So this is not a well chosen reference output, asserting only a correct initialization of this array. A least the number of times the procedure CheckTree is called should be reported as well.</div><div class=""><br class=""></div><div class="">For the time being (until I have crafted my private garbage collector ;-) within Oberon System V5 I will run the Tree benchmark only once or twice at a time.</div><div class=""><br class=""></div><div class="">Once again, thanks for your educational help and advice!</div><div class=""><br class=""></div><div class="">--</div><div class="">Hans<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">Op 13 apr. 2020, om 21:09 heeft Joerg <<a href="mailto:joerg.straube@iaeth.ch" class="">joerg.straube@iaeth.ch</a>> het volgende geschreven:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class="">Separate module or not, is not the key question. It does not help much. <div class="">As it is coded today (sort 5000 elements) Trees needs (worst case scenario) 160 kB heap space.</div><div class="">The Oberon system having only a total amount of 1MB offers ~420 kB heap space. So, it is impossible to run the algorithm 10 times.</div><div class=""><br class=""></div><div class="">The garbage collector freeing up unused heap space is programmed in module Oberon but it‘s not exported. So officially, you can’t run the GC while your program runs. The allocated and now unused memory is only collected AFTER the Hennessy terminates.</div><div class=""><br class=""></div><div class="">With a little bit of trickery you could program your own garbage collector that frees up all data structure Trees allocated with NEW after every call of Trees. But this is a little far fetched...</div><div class=""><br class=""><div dir="ltr" class="">br<br class=""><div class="">Jörg</div></div><div dir="ltr" class=""><br class=""><blockquote type="cite" class="">Am 13.04.2020 um 20:36 schrieb Hans Klaver <<a href="mailto:hklaver@dds.nl" class="">hklaver@dds.nl</a>>:<br class=""><br class=""></blockquote></div><blockquote type="cite" class=""><div dir="ltr" class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">Ah, now I see. <div class=""><br class=""></div><div class="">So my current implementation of the Tree benchmark in Hennessy.Mod is not correct, and is 'cheating'.</div><div class=""><br class=""></div><div class="">Maybe I should isolate the Tree benchmark as a separate module. This is also done in the C versions of the LLVM test-suite (for all benchmarks of the suite). And I suspect that the original Pascal versions of the Hennessy benchmarks also were separate programs, but I have never seen them.</div><div class=""><br class=""></div><div class="">--</div><div class="">Hans</div><div class=""><br class=""></div><div class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">Op 13 apr. 2020, om 20:15 heeft Joerg <<a href="mailto:joerg.straube@iaeth.ch" class="">joerg.straube@iaeth.ch</a>> het volgende geschreven:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class="">Hans<div class=""><br class=""></div><div class="">That „Trees“ seems to run faster is because I skip the execution if there is not enough memory.<div class=""><div class=""><br class=""></div><div class="">In other words, although Time() calls every algorithm 10 times, Trees will in a lot of cases only run 2 or 3 times (of those 10 calls) depending on the amount of heap space left...</div><div class=""><br class=""><div dir="ltr" class="">br<br class=""><div class="">Jörg</div></div><div dir="ltr" class=""><br class=""><blockquote type="cite" class="">Am 13.04.2020 um 19:47 schrieb Hans Klaver <<a href="mailto:hklaver@dds.nl" class="">hklaver@dds.nl</a>>:<br class=""><br class=""></blockquote></div><blockquote type="cite" class=""><div dir="ltr" class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">Hi Jörg,<div class=""><br class=""></div><div class="">Just now I noticed that my reply to your modification of Hennessy.Trees (below) did not make it to the list (possibly because I included a few screenprints of run times). </div><div class=""><br class=""></div><div class="">So now again:</div><div class=""><br class=""></div><div class="">Thanks Jörg, this modification is great! </div><div class="">Everything runs as it should now.<div class=""><br class=""></div><div class="">Now also in Oberon System V5 Hennessy.Mod can be used with ...MOD 65536 (sic!) in procedure Rand.</div><div class="">All reference output is as it should be.</div><div class=""><br class=""></div><div class="">And as a nice side effect of your modification the treesort benchmark runs nearly three times as fast as before:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Andale Mono";" class="">Run times Hennessy Mm and Sort procedures in V5 (10 runs, ms):</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Andale Mono"; min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Andale Mono";" class="">MOD     Trees     Intmm  Mm   Quick Bubble  Tree</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Andale Mono";" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">65535   original   983   998   900   2016   747</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">65536   original   984  1016   933   2017   --</div></div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Andale Mono";" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Andale Mono";" class="">65535   modified   966  1014   876   1954   647</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Andale Mono";" class="">65536   modified   970  1016   908   1971  *259*</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Andale Mono";" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">These are all benchmarks that make use of procedure Rand. As can be seen in most of them there is no noticable difference whether 65535 of 65536 is used in the MOD expression, but sometimes there can be a huge difference. </div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">This is an illustration that in benchmarks it is important to consistently use the same pseudo-random generator and initial seed.</div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">--</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">Hans Klaver</div></div><div class=""><br class=""></div><div class=""><br class=""><blockquote type="cite" class=""><div class="">Op 10 apr. 2020, om 13:20 heeft Jörg <<a href="mailto:joerg.straube@iaeth.ch" class="">joerg.straube@iaeth.ch</a>> het volgende geschreven:</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="DE" class="">Hans<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="DE" class=""><o:p class=""> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">I did the following:<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">PROCEDURE Trees* ();<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">                VAR i : LONGINT;<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">                BEGIN<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">                               IF Kernel.heapLim - Kernel.heapOrg - Kernel.allocated > 160000 THEN<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">                                               tInitarr();<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">                                               NEW(tree);<span class="Apple-converted-space"> </span><o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">                                               (* here the rest of Trees *)<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">                               END;<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">                               tree := NIL; Oberon.Collect(0) (* tell the GC to start after Hennessy terminated *)<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">                END Trees;<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class=""><o:p class=""> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">With these modifications you can take whatever random number generator you wanna use.<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">DIV 65535 (wrong) or DIV 65536 (corresponds to the C original) or any other.<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class=""><o:p class=""> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">br<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">Joerg<o:p class=""></o:p></span></div></div></div></blockquote></div></div></div></blockquote></div></div></div></div></div></blockquote></div></div></div></blockquote></div></div></div></blockquote></div><br class=""></div></body></html>