<html><head></head><body><div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div><div>Are we really arguing about the use of #basicAt: and #basicSize right now ???? Really ? Really ?!?!?!?<br><div><br><div><div>These methods are there for one reason : speed. If we find them "confusing", we really got a problem!<br><div><br>There are 127 senders of #basicAt: and 125 senders of #basicSize in the current Squeak 6.0 image...<br></div></div><div><br><br></div></div></div></div><div><br></div><div><br></div><div class="ydpf02706e1signature">----------------- <br>BenoƮt St-Jean <br>Yahoo! Messenger: bstjean
<br>Twitter: @BenLeChialeux
<br>Pinterest: benoitstjean
<br>Instagram: Chef_Benito<br>IRC: lamneth
<br>Blogue: endormitoire.wordpress.com
<br>"A standpoint is an intellectual horizon of radius zero". (A. Einstein)</div></div>
<div><br></div><div><br></div>
<div id="ydp5664587cyahoo_quoted_6190205099" class="ydp5664587cyahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Thursday, May 3, 2018, 1:34:17 p.m. EDT, Eliot Miranda <eliot.miranda@gmail.com> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div id="ydp5664587cyiv5961801722"><div><div dir="ltr"><br clear="none"><div class="ydp5664587cyiv5961801722gmail_extra"><br clear="none"><div class="ydp5664587cyiv5961801722gmail_quote">On Thu, May 3, 2018 at 10:12 AM, Chris Muller <span dir="ltr"><<a shape="rect" href="mailto:asqueaker@gmail.com" rel="nofollow" target="_blank">asqueaker@gmail.com</a>></span> wrote:<br clear="none"><blockquote class="ydp5664587cyiv5961801722gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex;">+1. Not only that, why the call to #basicSize and #basicAt:. Really?<br clear="none">
<br clear="none">
It's like... not even Smalltalk anymore... :(<br clear="none"></blockquote><div><br clear="none"></div><div>What? This is a workhorse method, and you want to create a block, and apply the block to each element, and convert each element from a character to an integer, when basicAt: yields (and has always yielded) integers in strings? You think that one line with a block and a high-level iterator is so much better than a two line with a simpler inner loop?</div><div> </div><div><div>| strings nothing allSatisfy basicAt |</div><div>strings := String allSubInstances.</div><div>strings := strings, strings, strings, strings, strings.</div><div>nothing := [:s|].</div><div>allSatisfy := [:s| s isAsciiStringWithAllSatisfy].</div><div>basicAt := [:s| s isAsciiStringWithBasicAt].</div><div>Smalltalk garbageCollect.</div><div>1 to: 2 do:</div><div><span class="ydp5664587cyiv5961801722gmail-Apple-tab-span" style="white-space: pre-wrap;"> </span>[:ign| times := { nothing. allSatisfy. basicAt } collect: [:block| [strings do: block] timeToRun]].</div><div>(times second - times first / (times third - times first) asFloat) roundTo: 0.1</div><div><br clear="none"></div><div>Answers range from 5.1 to 5.7 on 64-bits Mac OS X.</div></div><div><br clear="none"></div><div>You really want that elegance for something that is 5 times slower but one line shorter? I did this because I saw Patrick inline isAsciiString in mail message processing, and I thought a) his method would read better if it used isAsciiString, and b) isAsciiString can be implemented much better without affecting clients, so I went ahead. Part of the beauty of Smalltalk is that clients are insulated from implementation so that implementations can be improved. Since when has that not been a part of Smalltalk?</div><div class="ydp5664587cyiv5961801722yqt6686936369" id="ydp5664587cyiv5961801722yqtfd00416"><div><br clear="none"></div></div><blockquote class="ydp5664587cyiv5961801722gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex;"><div class="ydp5664587cyiv5961801722yqt6686936369" id="ydp5664587cyiv5961801722yqtfd97602">
</div><div class="ydp5664587cyiv5961801722gmail-HOEnZb"><div class="ydp5664587cyiv5961801722gmail-h5"><div class="ydp5664587cyiv5961801722yqt6686936369" id="ydp5664587cyiv5961801722yqtfd63330"><br clear="none">
On Thu, May 3, 2018 at 3:41 AM, Tobias Pape <<a shape="rect" href="mailto:Das.Linux@gmx.de" rel="nofollow" target="_blank">Das.Linux@gmx.de</a>> wrote:<br clear="none">
> Hi Eliot<br clear="none">
><br clear="none">
>> On 03.05.2018, at 09:56, <a shape="rect" href="mailto:commits@source.squeak.org" rel="nofollow" target="_blank">commits@source.squeak.org</a> wrote:<br clear="none">
>><br clear="none">
>> Eliot Miranda uploaded a new version of Collections to project The Trunk:<br clear="none">
>> <a shape="rect" href="http://source.squeak.org/trunk/Collections-eem.792.mcz" rel="nofollow" target="_blank">http://source.squeak.org/ trunk/Collections-eem.792.mcz</a><br clear="none">
>><br clear="none">
>> ==================== Summary ====================<br clear="none">
>><br clear="none">
>> Name: Collections-eem.792<br clear="none">
>> Author: eem<br clear="none">
>> Time: 3 May 2018, 12:55:52.175146 am<br clear="none">
>> UUID: 7d8995ed-835e-44b0-bf4c- 0b0780f5c96f<br clear="none">
>> Ancestors: Collections-pre.791<br clear="none">
>><br clear="none">
>> Four times faster implementation of isAsciiString.<br clear="none">
>><br clear="none">
>> =============== Diff against Collections-pre.791 ===============<br clear="none">
>><br clear="none">
>> Item was changed:<br clear="none">
>> ----- Method: String>>isAsciiString (in category 'testing') -----<br clear="none">
>> isAsciiString<br clear="none">
>> + "Answer if the receiver contains only ascii characters.<br clear="none">
>> + Inline ^self allSatisfy: [ :each | each asciiValue <= 127 ] for speed."<br clear="none">
>> + 1 to: self basicSize do: [:i| (self basicAt: i) > 127 ifTrue: [^false]].<br clear="none">
>> + ^true!<br clear="none">
>> -<br clear="none">
>> - ^self allSatisfy: [ :each | each asciiValue <= 127 ]!<br clear="none">
>><br clear="none">
>><br clear="none">
><br clear="none">
> Although I am in awe of the performance improvement, I am curious wether it really pays of to inline #allSatify: here, in terms of performance vs. readability.<br clear="none">
><br clear="none">
> I presume that, given the current use of #isAsciiString, we can stay with the more compact, readable version that does not need the 'caveat lector'-comment at the beginning of the method.<br clear="none">
><br clear="none">
><br clear="none">
> Best regards</div><br clear="none">
> -Tobias<br clear="none">
><br clear="none">
><br clear="none">
<br clear="none">
</div></div></blockquote></div><br clear="none"><br clear="all"><div><br clear="none"></div>-- <br clear="none"><div class="ydp5664587cyiv5961801722gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate;"></span><div>_,,,^..^,,,_<br clear="none"></div><div>best, Eliot</div></div></div></div><div class="ydp5664587cyiv5961801722yqt6686936369" id="ydp5664587cyiv5961801722yqtfd36380">
</div></div></div></div></div><div class="ydp5664587cyqt6686936369" id="ydp5664587cyqtfd17225"><br clear="none"></div></div>
</div>
</div></div></body></html>