[squeak-dev] The Trunk: Collections-ul.964.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Tue Nov 30 09:57:58 UTC 2021


Thank you :-)

Best,
Marcel
Am 29.11.2021 20:10:14 schrieb commits at source.squeak.org <commits at source.squeak.org>:
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.964.mcz

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

Name: Collections-ul.964
Author: ul
Time: 29 November 2021, 8:04:44.235979 pm
UUID: 51dbb755-a7ad-4396-807d-d6b24815c1d4
Ancestors: Collections-mt.963

- fixed OrderedDictionary >> #growTo:: if the argument is smaller than the capacity, #grownBy: cannot work. The change also makes #rehash faster by leaving the order variable intact.
- updated the comment of HashedCollection >> #growTo:
- renamed newCapacity to newArraySize in HashedCollection >> #compact because #sizeFor: returns the array size and not the capacity of the hashed collection. Also, if the size of array wouldn't change, do not nothing.
- removed the private method with no senders Dictionary >> #valueAtNewKey:put:atIndex:declareFrom:

=============== Diff against Collections-mt.963 ===============

Item was removed:
- ----- Method: Dictionary>>valueAtNewKey:put:atIndex:declareFrom: (in category 'private') -----
- valueAtNewKey: aKey put: anObject atIndex: index declareFrom: aDictionary
- "Support for coordinating class variable and global declarations
- with variables that have been put in Undeclared so as to
- redirect all references to the undeclared variable."
-
- (aDictionary includesKey: aKey)
- ifTrue:
- [self atNewIndex: index
- put: ((aDictionary associationAt: aKey) value: anObject).
- aDictionary removeKey: aKey]
- ifFalse:
- [self atNewIndex: index put: (self associationClass key: aKey value: anObject)]!

Item was changed:
----- Method: HashedCollection>>compact (in category 'private') -----
compact
"Reduce the size of array so that the load factor will be ~75%."

+ | newArraySize |
+ newArraySize := self class sizeFor: self slowSize.
+ array size = newArraySize ifFalse: [
+ self growTo: newArraySize ]!
- | newCapacity |
- newCapacity := self class sizeFor: self slowSize.
- self growTo: newCapacity!

Item was changed:
----- Method: HashedCollection>>growTo: (in category 'private') -----
growTo: anInteger
+ "Grow the elements array and reinsert the old elements. Do it even if the size of the array is the same as the argument because this methods is also used to rehash the collection."
- "Grow the elements array and reinsert the old elements"

| oldElements |
oldElements := array.
array := self arrayType new: anInteger.
self noCheckNoGrowFillFrom: oldElements!

Item was changed:
----- Method: OrderedDictionary>>growTo: (in category 'private') -----
growTo: anInteger

+ | newCapacity capacityDifference |
super growTo: anInteger.
+ newCapacity := self capacity.
+ capacityDifference := newCapacity - order size.
+ capacityDifference = 0 ifTrue: [ ^self ].
+ order := capacityDifference > 0
+ ifTrue: [ order grownBy: capacityDifference ]
+ ifFalse: [ order first: newCapacity ]!
- order := order grownBy: self capacity - order size!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211130/3749c719/attachment.html>


More information about the Squeak-dev mailing list