Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.253.mcz==================== Summary ====================
Name: Collections-ul.253
Author: ul
Time: 14 December 2009, 6:15:34 am
UUID: 2aa55fbb-6918-024a-b850-2c2b3400fcfe
Ancestors: Collections-ul.252
- faster Association creation
- removed obsolete comment from Character >> #=
- removed HashedCollection >> #findElementOrNil: because it's private and deprecated
- changed HashedCollection >> #fullCheck to really keep the 1/4 of the array free
- inlined #fullCheck into HashedCollection >> #atNewIndex:put:
=============== Diff against Collections-ul.252 ===============
Item was changed:
----- Method: HashedCollection>>fullCheck (in category 'private') -----
fullCheck
+
"Keep array at least 1/4 free for decent hash behavior"
+ array size * 3 // 4 < tally ifTrue: [ self grow ]!
- array size - tally < (array size // 4 max: 1)
- ifTrue: [self grow]!
Item was changed:
----- Method: Character>>= (in category 'comparing') -----
= aCharacter
- "Primitive. Answer true if the receiver and the argument are the same
- object (have the same object pointer) and false otherwise. Optional. See
- Object documentation whatIsAPrimitive."
+ ^self == aCharacter or: [
+ aCharacter isCharacter and: [ self asciiValue = aCharacter asciiValue ] ]!
- ^ self == aCharacter or:[
- aCharacter isCharacter and: [self asciiValue = aCharacter asciiValue]]!
Item was changed:
----- Method: HashedCollection>>atNewIndex:put: (in category 'private') -----
atNewIndex: index put: anObject
+
array at: index put: anObject.
tally := tally + 1.
+ "Keep array at least 1/4 free for decent hash behavior"
+ array size * 3 < (tally * 4) ifTrue: [ self grow ]!
- self fullCheck!
Item was changed:
----- Method: Association class>>key:value: (in category 'instance creation') -----
key: newKey value: newValue
"Answer an instance of me with the arguments as the key and value of
the association."
+ ^self basicNew key: newKey value: newValue!
- ^(super key: newKey) value: newValue!
Item was removed:
- ----- Method: HashedCollection>>findElementOrNil: (in category 'private') -----
- findElementOrNil: anObject
- "Answer the index of a first slot containing either a nil (indicating an empty slot) or an element that matches the given object. Answer the index of that slot or zero. Fail if neither a match nor an empty slot is found."
-
- | index |
- self deprecated: 'Use #scanFor:.'.
- index := self scanFor: anObject.
- index > 0 ifTrue: [^index].
-
- "Bad scene. Neither have we found a matching element
- nor even an empty slot. No hashed set is ever supposed to get
- completely full."
- self error: 'There is no free space in this set!!'.!