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

commits at source.squeak.org commits at source.squeak.org
Mon Oct 19 23:00:17 UTC 2009


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

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

Name: Collections-nice.168
Author: nice
Time: 19 October 2009, 10:59:45 am
UUID: c006741a-d74a-9442-a096-ecd92a04f199
Ancestors: Collections-nice.167

Generalize the fasterKeys trick implementation.
Most senders of keys won't need a Set.
(81 of 129 trunk senders after a first pass, surely more)

=============== Diff against Collections-nice.167 ===============

Item was added:
+ ----- Method: Dictionary>>fasterKeys (in category 'accessing') -----
+ fasterKeys
+ 	"most uses of keys don't need a Set.
+ 	This method is faster than keys, because no lookup: will be performed"
+ 	
+ 	^Array new: self size streamContents: [:s| self keysDo: [:key| s nextPut: key]]!

Item was added:
+ ----- Method: KeyedSet>>fasterKeys (in category 'accessing') -----
+ fasterKeys
+ 	"most uses of keys don't need a Set.
+ 	This method is faster than keys, because no lookup: will be performed"
+ 	
+ 	^Array new: self size streamContents: [:s| self keysDo: [:key| s nextPut: key]]!

Item was added:
+ ----- Method: WeakRegistry>>fasterKeys (in category 'accessing') -----
+ fasterKeys
+ 	^self protected:[
+ 		Array streamContents:[:s| valueDictionary keysDo:[:key| s nextPut: key]]].!

Item was removed:
- ----- Method: IdentityDictionary>>fasterKeys (in category 'private') -----
- fasterKeys
- 	"This was taking some time in publishing and we didn't really need a Set"
- 	| answer index |
- 	answer := Array new: self size.
- 	index := 0.
- 	self keysDo: [:key | answer at: (index := index + 1) put: key].
- 	^ answer!




More information about the Squeak-dev mailing list