<div dir="ltr">Great! good to see that bread first is faster.<br><div>I thought about it but did not have the time to try it and I thought depth first was not really a problem because the execution stack should handle without problem. In my image the deepest hierarchy size is 16, not a big deal</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 21, 2019 at 4:30 PM Andres Valloud via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">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">What do you see as "ugly"?<br>
<br>
One detail I don't see mentioned here: the old code filled the ordered <br>
collection breadth first (before the set conversion), and so it has <br>
limited execution stack depth. The current code fills the collection <br>
depth first, so its execution stack depth is as deep as the hierarchy tree.<br>
<br>
Maybe there was a reason why the users of allSubclasses were better off <br>
with breadth first, before someone put in asSet. Or perhaps asSet was <br>
always there, I don't see why that was beneficial.<br>
<br>
In any case, I tried both the recursive and (properly implemented) <br>
iterative methods: breadth first is >20% faster.<br>
<br>
On 8/21/19 05:44, Juan Vuletich via Cuis-dev wrote:<br>
> Wow, thanks. The old code was slow and ugly!<br>
> <br>
> Integrating it.<br>
> <br>
> Cheers,<br>
> <br>
> -- <br>
> Juan Vuletich<br>
> <a href="http://www.cuis-smalltalk.org" rel="noreferrer" target="_blank">www.cuis-smalltalk.org</a><br>
> <a href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev" rel="noreferrer" target="_blank">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a><br>
> <a href="https://github.com/jvuletich" rel="noreferrer" target="_blank">https://github.com/jvuletich</a><br>
> <a href="https://www.linkedin.com/in/juan-vuletich-75611b3" rel="noreferrer" target="_blank">https://www.linkedin.com/in/juan-vuletich-75611b3</a><br>
> @JuanVuletich<br>
> <br>
> <br>
> On 8/21/2019 9:26 AM, Hernan Wilkinson via Cuis-dev wrote:<br>
>> Hi,<br>
>> attached is a cs that changes the implementation of #allSubclasses <br>
>> and #withAllSubclasses and generates performance improvement drastically.<br>
>> Just as a quick example, with the current implementation:<br>
>> Time millisecondsToRun: [ 100 timesRepeat: [Behavior <br>
>> withAllSubclasses ]] 1140 .<br>
>> With the proposed change:<br>
>> Time millisecondsToRun: [ 100 timesRepeat: [Behavior <br>
>> withAllSubclasses2 ]] . 73<br>
>><br>
>> In the type checker of LiveTyping, checking Behavior goes from 9.5 <br>
>> seconds to 5 seconds only with that change.<br>
>> One difference between the current and proposed version, is that the <br>
>> current returns a Set while the proposed version returns an <br>
>> OrderedCollection.<br>
>> I looked carefully if that could break something and it does not. <br>
>> I've been using the image with this new implementation and everything <br>
>> works fine.<br>
>><br>
>> Juan, please take a look at it and integrate it if you think it is <br>
>> useful.<br>
>> Hernan.<br>
>><br>
>> -- <br>
>> *Hernán Wilkinson<br>
>> Agile Software Development, Teaching & Coaching*<br>
>> *Phone: +54-011*-4893-2057<br>
>> *Twitter: @HernanWilkinson*<br>
>> *site: <a href="http://www.10Pines.com" rel="noreferrer" target="_blank">http://www.10Pines.com</a> <<a href="http://www.10pines.com/" rel="noreferrer" target="_blank">http://www.10pines.com/</a>>*<br>
>> Address: Alem 896, Floor 6, Buenos Aires, Argentina<br>
> <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" class="gmail_signature"><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>