[squeak-dev] The Trunk: XML-Parser-nice.21.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Dec 22 19:54:28 UTC 2009


Nicolas Cellier uploaded a new version of XML-Parser to project The Trunk:
http://source.squeak.org/trunk/XML-Parser-nice.21.mcz

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

Name: XML-Parser-nice.21
Author: nice
Time: 22 December 2009, 8:55:02 am
UUID: 3c322104-f28b-094e-ad05-467b11b0e5bc
Ancestors: XML-Parser-nice.20

Never ask String to findFirstInString:inSet:startingAt: because this will always be slow in an image with wide characters...

Rather ask aString class to do the job, it might be fast if it is a ByteString.

=============== Diff against XML-Parser-nice.20 ===============

Item was changed:
  ----- Method: XMLWriter>>pcData: (in category 'writing xml') -----
  pcData: aString
  	| lastIndex nextIndex |
  	lastIndex := 1.
  	"Unroll the first search to avoid copying"
+ 	nextIndex := aString class findFirstInString: aString inSet: XMLTranslationMap startingAt: lastIndex.
- 	nextIndex := String findFirstInString: aString inSet: XMLTranslationMap startingAt: lastIndex.
  	nextIndex = 0 ifTrue:[^self stream nextPutAll: aString].
  	[self stream nextPutAll: (aString copyFrom: lastIndex to: nextIndex-1).
  	self stream nextPutAll: (XMLTranslation at: (aString at: nextIndex)).
  	lastIndex := nextIndex + 1.
+ 	nextIndex := aString class findFirstInString: aString inSet: XMLTranslationMap startingAt: lastIndex.
- 	nextIndex := String findFirstInString: aString inSet: XMLTranslationMap startingAt: lastIndex.
  	nextIndex = 0] whileFalse.
  	self stream nextPutAll: (aString copyFrom: lastIndex to: aString size).!




More information about the Squeak-dev mailing list