[Pkg] The Trunk: Collections-eem.734.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Feb 24 23:53:16 UTC 2017


Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.734.mcz

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

Name: Collections-eem.734
Author: eem
Time: 24 February 2017, 3:51:29.783168 pm
UUID: a81dce52-1da2-4c87-b8a7-fd6bf485396b
Ancestors: Collections-topa.733

Eliminate the ugly hack to speed up stream wide character writes.  The trade-offs with Spur have changed and the cure is now arguably worse than the disease.  The VM no longer supports the primitive (since it cannot be sufficiently polymorphic).  hence the hack is paid for on every write but pays off only on wide chaacter writes to byte strings.  Now that Spur's become is much faster than V3 let's accept that the writing of a wide character to a byte string stream won't be as fast, since all other stream writes will be.

Slightly faster (and correctly commented) version of isSeparator.

=============== Diff against Collections-topa.733 ===============

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."
  
  	| integerValue |
+ 	(integerValue := self asInteger) > 32 ifTrue: [^false].
+ 	^#(false false false false false false false false false
+ 		true "9 = tab"
+ 		true "10 = line feed"
+ 		false
+ 		true "12 = form feed"
+ 		true "13 = cr"
+ 		false false false false false false false false false false false false false false false false false false
+ 		true) at: integerValue + 1!
- 	(integerValue := self asInteger) > 32 ifTrue: [ ^false ].
- 	integerValue
- 		caseOf: {
- 			[ 32 "space" ] -> [ ^true ].
- 			[ 9 "cr" ] -> [ ^true ].
- 			[ 13 "tab"] -> [ ^true ].
- 			[ 10 "line feed" ] -> [ ^true ] }
- 		otherwise: [ ^integerValue = 12 "form feed" ]!

Item was changed:
  ----- Method: WriteStream>>nextPut: (in category 'accessing') -----
  nextPut: anObject 
  	"Primitive. Insert the argument at the next position in the Stream
  	represented by the receiver. Fail if the collection of this stream is not an
  	Array or a String. Fail if the stream is positioned at its end, or if the
  	position is out of bounds in the collection. Fail if the argument is not
  	of the right type for the collection. Optional. See Object documentation
  	whatIsAPrimitive."
  
  	<primitive: 66>
- 	((collection class == ByteString) and: [
- 		anObject isCharacter and:[anObject isOctetCharacter not]]) ifTrue: [
- 			collection := (WideString from: collection).
- 			^self nextPut: anObject.
- 	].
  	position >= writeLimit
  		ifTrue: [^ self pastEndPut: anObject]
  		ifFalse: 
  			[position := position + 1.
  			^collection at: position put: anObject]!



More information about the Packages mailing list