<div dir="ltr">Hi,<br><div> as we all know software development is about making tradeoffs all the time. The change in #timesRepeat: is interesting and definitely shows a lot of knowledge behind it, but it also adds some complexity that makes it difficult to understand and explain.</div><div> The original #timesRepeat: implementation is very nice and simple which makes it an interesting example to show as I do when teaching at the university. It's a great example of Smalltalk's simplicity and ability to create "control flow messages" using the same language and without having to change the syntax and compiler.</div><div> I made a simple performance test to see the impact of the change:</div><div><br></div><div>Smalltalk garbageCollect.<br>Time millisecondsToRun: [ 100000000 timesRepeat: []].<br></div><div><br></div><div> With the original implementation the average in my machine gives 462 and with the other implementation gives 367, so a 100 milliseconds improvement in one hundred millions iterations. </div><div> </div><div> So, for me it is so little that we gain compared with the complexity it adds that I would not put that in the base image. I would put it in a package that anybody could load if that improvement was necessary and leave the original implementation in the base as an example of Smalltalk simplicity and beauty. </div><div><br></div><div>Best,</div><div>Hernan.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Nov 9, 2019 at 1:19 AM Andres Valloud via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
>> First, especially in 32 bit systems, it's very important never to send <br>
>> timesRepeat: to a large integer --- this is why the large integer <br>
>> method splits the process in rounds of timesRepeat: sent to small <br>
>> integers. <br>
> <br>
> I guess you mean 'never run the iteration on LargeInteger arithmetic', <br>
> so with the splitting in LargePositiveInteger, sending timesRepeat: to a <br>
> large integer is ok...<br>
<br>
Yeah, that's what I meant. If you only had the simple implementation in <br>
Integer, then the to:do: will create large integers for every iteration. <br>
That is a) slow in itself, and b) creates garbage that later has to be <br>
collected.<br>
<br>
> Interesting. Not the case in Cuis, where there is no Compiler <br>
> optimization of #timesRepeat:<br>
<br>
Right --- if that did happen though, then we'd be looking at writing <br>
timesRepeat: [aBlock value].<br>
<br>
> Still, I wasn't explicit on what I really wanted to ask... My question <br>
> is: Is #bench (or bench: seconds) a good replacement for #timesRepeat:? <br>
> If so, does still make sense to have an optimized version of #timesRepeat:?<br>
<br>
If there was bench: seconds, and if that accepted a float argument so <br>
one could say things like bench: 1.5 and things like that, then the <br>
timesRepeat: improvement would be less important for this use case.<br>
<br>
The timesRepeat: improvements might still matter, but we'd have to find <br>
another justification for them first.<br>
<br>
Andres.<br>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal"><span style="font-weight:bold">Hernán Wilkinson</span><br>Agile Software Development, Teaching & Coaching</span></font></span></span></span></strong></span></div><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal">Phone: +54-011</span></font></span></span></span></strong></span><font face="tahoma, sans-serif" size="2">-4893-2057</font></div><div><strong style="font-family:tahoma,sans-serif;font-size:xx-small"><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Twitter: @HernanWilkinson</span></font></span></span></strong></div><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal">site: <a href="http://www.10pines.com/" style="color:rgb(17,65,112)" target="_blank">http://www.10Pines.com</a></span></font></span></span></span></strong></span></div><div><font face="tahoma, sans-serif"><span style="border-collapse:collapse">Address: Alem 896</span></font>, Floor 6, Buenos Aires, Argentina</div></div></div></div></div></div></div></div></div></div></div></div>