[squeak-dev] The Trunk: Collections-nice.337.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Mar 14 23:00:38 UTC 2010


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

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

Name: Collections-nice.337
Author: nice
Time: 15 March 2010, 12:00:01.788 am
UUID: 3ab4c3f1-efb0-45eb-ab03-ee128eb95705
Ancestors: Collections-nice.336

Speed-up Character digitValue PART 2.
Now get rid of class var initialization guard.
Also use value instead of charCode to reach almost a x2 speedup (5x for lowercase).

Benchmark:
['0123456789' do: [:e | e digitValue]] bench
NEW '312686.2627474505 per second.'
ORIG  '197284.9430113977 per second.'

['0123456789ABCDEF' do: [:e | e digitValue]] bench
NEW '208848.6302739452 per second.
BEFORE '120782.4435112977 per second.'

['0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' do: [:e | e digitValue]] bench
NEW '116395.9208158368 per second.'
ORIG '55508.49830033993 per second.'

['0123456789abcdefghijklmnopqrstuvwxyz' do: [:e | e digitValue]] bench
NEW '108928.8142371526 per second.'
ORIG '21273.34533093381 per second.'


=============== Diff against Collections-nice.336 ===============

Item was changed:
  ----- Method: Character>>digitValue (in category 'accessing') -----
  digitValue
  	"Answer 0-9 if the receiver is $0-$9, 10-35 if it is $A-$Z, and < 0 
  	otherwise. This is used to parse literal numbers of radix 2-36."
  
+ 	value > 16rFF ifTrue: [^(EncodedCharSet charsetAt: self leadingChar) digitValueOf: self].
+ 	^DigitValues at: 1 + value!
- 	| code |
- 	(code := self charCode) > 16rFF ifTrue: [^(EncodedCharSet charsetAt: self leadingChar) digitValueOf: self].
- 	DigitValues ifNil: [self class initializeDigitValues].
- 	^DigitValues at: 1 + code!




More information about the Squeak-dev mailing list