The Trunk: Collections-tfel.624.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-tfel.624.mcz

commits-2
Tim Felgentreff uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-tfel.624.mcz

==================== Summary ====================

Name: Collections-tfel.624
Author: tfel
Time: 1 May 2015, 3:39:37.7 pm
UUID: 5cb7424e-b88f-3b4e-beb3-c97639f2d91f
Ancestors: Collections-tfel.623

remove overrides for beginsWith: in ByteStrings and ByteSymbols, because these actually perform worse now than the generic implementation in String

=============== Diff against Collections-tfel.623 ===============

Item was removed:
- ----- Method: ByteString>>beginsWith: (in category 'testing') -----
- beginsWith: sequence
- "Answer whether the receiver begins with the given sequence. The comparison is case-sensitive. Overridden for better performance."
-
- | sequenceSize |
- sequence class isBytes ifFalse: [ ^super beginsWith: sequence ].
- ((sequenceSize := sequence size) = 0 or: [ self size < sequenceSize ]) ifTrue: [ ^false ].
- "The following method uses a suboptimal algorithm (brute force pattern matching with O(n^2) worst case runtime), but the primitive in C is so fast (assuming large alphabets), that it's still worth using it instead of linear time pure smalltalk implementation. There are some obvious cases when the brute force algorithm is suboptimal, e.g. when the first elements don't match, so let's compare them here before using the primitive."
- (self basicAt: 1) = (sequence basicAt: 1) ifFalse: [ ^false ].
- ^(self findSubstring: sequence in: self startingAt: 1 matchTable: CaseSensitiveOrder) = 1!

Item was removed:
- ----- Method: ByteSymbol>>beginsWith: (in category 'testing') -----
- beginsWith: sequence
- "Answer whether the receiver begins with the given sequence. The comparison is case-sensitive. Overridden for better performance."
-
- | sequenceSize |
- sequence class isBytes ifFalse: [ ^super beginsWith: sequence ].
- ((sequenceSize := sequence size) = 0 or: [ self size < sequenceSize ]) ifTrue: [ ^false ].
- "The following method uses a suboptimal algorithm (brute force pattern matching with O(n^2) worst case runtime), but the primitive in C is so fast (assuming large alphabets), that it's still worth using it instead of linear time pure smalltalk implementation. There are some obvious cases when the brute force algorithm is suboptimal, e.g. when the first elements don't match, so let's compare them here before using the primitive."
- (self basicAt: 1) = (sequence basicAt: 1) ifFalse: [ ^false ].
- ^(self findSubstring: sequence in: self startingAt: 1 matchTable: CaseSensitiveOrder) = 1!