[squeak-dev] The Inbox: Collections-nice.807.mcz
Levente Uzonyi
leves at caesar.elte.hu
Thu Sep 13 22:35:09 UTC 2018
On Thu, 13 Sep 2018, commits at source.squeak.org wrote:
> Nicolas Cellier uploaded a new version of Collections to project The Inbox:
> http://source.squeak.org/inbox/Collections-nice.807.mcz
>
> ==================== Summary ====================
>
> Name: Collections-nice.807
> Author: nice
> Time: 13 September 2018, 9:29:57.057799 pm
> UUID: f4686e6e-1820-4c3f-841d-c1904914c147
> Ancestors: Collections-topa.806
>
> Let isSeparator be consistent with Character separators after introduction of nbsp.
>
> The performance cost should be marginal.
>
> Note: some (CharacterSet cleanUp: false) might be necessary in postscript, unless this is included in the release process...
>
> =============== Diff against Collections-topa.806 ===============
>
> Item was changed:
> ----- Method: Character>>isSeparator (in category 'testing') -----
> isSeparator
> "Answer whether the receiver is one of the separator characters--space,
> + cr, tab, line feed, or form feed and nbsp."
> - cr, tab, line feed, or form feed."
>
> | integerValue |
> + (integerValue := self asInteger) > 32 ifTrue: [ ^integerValue = 160 "non breaking space" ].
Unfortunately the current JIT will not optimize that construct the same
way as the ones used in the current implementation, so it'd still be
~1-1.5x slower to use this compared to the "compare with constant and do
a quick return" formula. If we really want to push this change, I'd rather
try something like this:
(integerValue := self asInteger) > 32 ifTrue: [
integerValue = 160 ifTrue: [ ^true ].
^false ].
Levente
> - (integerValue := self asInteger) > 32 ifTrue: [ ^false ].
> integerValue
> caseOf: {
> [ 32 "space" ] -> [ ^true ].
> [ 9 "tab" ] -> [ ^true ].
> [ 13 "cr"] -> [ ^true ].
> [ 10 "line feed" ] -> [ ^true ].
> [ 12 "form feed"] -> [ ^true ] }
> otherwise: [ ^false ]!
More information about the Squeak-dev
mailing list
|