[squeak-dev] The Trunk: Collections-ul.900.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Jun 23 20:48:30 UTC 2020
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.900.mcz
==================== 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
mailing list
|