[squeak-dev] The Trunk: Collections-eem.792.mcz

Chris Muller asqueaker at gmail.com
Thu May 3 17:12:37 UTC 2018


+1.  Not only that, why the call to #basicSize and #basicAt:.  Really?

It's like...  not even Smalltalk anymore...   :(

On Thu, May 3, 2018 at 3:41 AM, Tobias Pape <Das.Linux at gmx.de> wrote:
> Hi Eliot
>
>> On 03.05.2018, at 09:56, commits at source.squeak.org wrote:
>>
>> Eliot Miranda uploaded a new version of Collections to project The Trunk:
>> http://source.squeak.org/trunk/Collections-eem.792.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Collections-eem.792
>> Author: eem
>> Time: 3 May 2018, 12:55:52.175146 am
>> UUID: 7d8995ed-835e-44b0-bf4c-0b0780f5c96f
>> Ancestors: Collections-pre.791
>>
>> Four times faster implementation of isAsciiString.
>>
>> =============== Diff against Collections-pre.791 ===============
>>
>> Item was changed:
>>  ----- Method: String>>isAsciiString (in category 'testing') -----
>>  isAsciiString
>> +     "Answer if the receiver contains only ascii characters.
>> +      Inline ^self allSatisfy: [ :each | each asciiValue <= 127 ] for speed."
>> +     1 to: self basicSize do: [:i| (self basicAt: i) > 127 ifTrue: [^false]].
>> +     ^true!
>> -
>> -     ^self allSatisfy: [ :each | each asciiValue <= 127 ]!
>>
>>
>
> 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.
>
> 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.
>
>
> Best regards
>         -Tobias
>
>


More information about the Squeak-dev mailing list