Levente Uzonyi uploaded a new version of Collections to project The Trunk: http://source.squeak.org/trunk/Collections-ul.955.mcz
==================== Summary ====================
Name: Collections-ul.955 Author: ul Time: 3 September 2021, 3:44:11.962377 pm UUID: 1da522b7-35ee-4391-8036-93274b292972 Ancestors: Collections-dtl.954
- significantly speed up WriteStream>>nextChunkPut: - apply the same pattern to String>>storeOn:. In this case the speedup depends on the input string. But for the most common cases it should be faster.
=============== Diff against Collections-dtl.954 ===============
Item was changed: ----- Method: String>>storeOn: (in category 'printing') ----- storeOn: aStream "Print inside string quotes, doubling embedded quotes." + + | start matchIndex | - | x | aStream nextPut: $'. + start := 1. + [ (matchIndex := self indexOf: $' startingAt: start) = 0 ] whileFalse: [ + aStream + next: matchIndex - start + 1 putAll: self startingAt: start; + nextPut: $'. + start := matchIndex + 1 ]. + aStream + next: self size - start + 1 putAll: self startingAt: start; + nextPut: $'! - 1 to: self size do: - [:i | - aStream nextPut: (x := self at: i). - x = $' ifTrue: [aStream nextPut: x]]. - aStream nextPut: $'!
Item was changed: ----- Method: WriteStream>>nextChunkPut: (in category 'fileIn/Out') ----- nextChunkPut: aString "Append the argument, aString, to the receiver, doubling embedded terminators."
+ | start matchIndex | + start := 1. + [ (matchIndex := aString indexOf: $!! startingAt: start) = 0 ] whileFalse: [ + self + next: matchIndex - start + 1 putAll: aString startingAt: start; + nextPut: $!!. + start := matchIndex + 1 ]. + self next: aString size - start + 1 putAll: aString startingAt: start. - | i remainder terminator | - terminator := $!!. - remainder := aString. - [(i := remainder indexOf: terminator) = 0] whileFalse: - [self nextPutAll: (remainder copyFrom: 1 to: i). - self nextPut: terminator. "double imbedded terminators" - remainder := remainder copyFrom: i+1 to: remainder size]. - self nextPutAll: remainder. aString includesUnifiedCharacter ifTrue: [ + self nextPutAll: '!!]lang['. + aString writeLeadingCharRunsOn: self ]. + self nextPut: $!! - self nextPut: terminator. - self nextPutAll: ']lang['. - aString writeLeadingCharRunsOn: self. - ]. - self nextPut: terminator. !
packages@lists.squeakfoundation.org