[squeak-dev] The Trunk: Collections-ul.900.mcz
leves at caesar.elte.hu
Mon Jun 29 00:13:17 UTC 2020
Thanks. Collections-ul.901 should have that fixed.
On Sun, 28 Jun 2020, Jakob Reschke wrote:
> Hi Levente,
> An uncommented side effect of PositionableStream>>match: is that it
> sets the stream to the end if there is no match. Your optimized
> version does not exhibit this side effect. This is one cause of the
> current bug with traitCompositions. See the usage in
> Kind regards,
> Am Di., 23. Juni 2020 um 22:48 Uhr schrieb <commits at source.squeak.org>:
>> Levente Uzonyi uploaded a new version of Collections to project The Trunk:
>> ==================== Summary ====================
>> Name: Collections-ul.900
>> Author: ul
>> Time: 23 June 2020, 10:48:18.28482 pm
>> UUID: ff11e218-b6f4-44db-bd02-2e2284158946
>> Ancestors: Collections-mt.898
>> - enable the use of primitive 158 in String >> #compareWith:collated: because when collation is specified, the VM does not use the jitted version
>> - fix: String >> #compare:caseSensitive: needs to transform the return value of String >> #compareWith:collated:
>> - speed up ReadStream >> #match: when the receiver's class is ReadStream
>> =============== Diff against Collections-mt.898 ===============
>> Item was added:
>> + ----- Method: ReadStream>>match: (in category 'positioning') -----
>> + match: subCollection
>> + "Faster version than the one implemented by super, but due to my subclasses breaking various invariants true for actual ReadStreams, only use it when the receiver's class is ReadStream."
>> + | matchPosition |
>> + self class == ReadStream ifFalse: [ ^super match: subCollection ].
>> + subCollection isEmpty ifTrue: [ ^true ].
>> + matchPosition := collection indexOfSubCollection: subCollection startingAt: position + 1.
>> + matchPosition = 0 ifTrue: [ ^false ].
>> + matchPosition <= readLimit ifFalse: [ ^false ].
>> + position := matchPosition + subCollection size - 1.
>> + ^true!
>> Item was changed:
>> ----- Method: String>>compare:caseSensitive: (in category 'comparing') -----
>> compare: aString caseSensitive: aBool
>> "Answer a comparison code telling how the receiver sorts relative to aString:
>> 1 - before
>> 2 - equal
>> 3 - after.
>> + | map result |
>> - | map |
>> map := aBool ifTrue:[CaseSensitiveOrder] ifFalse:[CaseInsensitiveOrder].
>> + result := self compareWith: aString collated: map.
>> + result = 0 ifTrue: [ ^2 ].
>> + ^result > 0
>> + ifTrue: [ 3 ]
>> + ifFalse: [ 1 ]!
>> - ^(self compareWith: aString collated: map) + 2!
>> Item was changed:
>> ----- Method: String>>compareWith:collated: (in category 'comparing') -----
>> compareWith: aString collated: collation
>> + <primitive: 158>
>> - "<primitive: 158>"
>> ^(self compare: self with: aString collated: collation) - 2!
More information about the Squeak-dev