Levente Uzonyi uploaded a new version of Collections to project The Trunk: http://source.squeak.org/trunk/Collections-ul.783.mcz
==================== Summary ====================
Name: Collections-ul.783 Author: ul Time: 5 March 2018, 10:52:44.810023 pm UUID: 3cb7824b-9833-4ab9-bbac-66e36049b6ed Ancestors: Collections-ul.782
WeakIdentityKeyDictionary changes: - implemented #slowSize to be able to count of actually stored associations - overridden #compact to cut tally back based on #slowSize - compact the dictionary after removing unreferenced keys in #removeUnreferencedKeys
This all will ensure that if Undeclared is empty, then #isEmpty will return true after Smalltalk cleanOutUndeclared is executed.
=============== Diff against Collections-ul.782 ===============
Item was added: + ----- Method: WeakIdentityDictionary>>compact (in category 'private') ----- + compact + "Reduce the size of array so that the load factor will be ~75%." + + | newCapacity | + tally := self slowSize. + newCapacity := self class goodPrimeAtLeast: tally * 4 // 3. + self growTo: newCapacity!
Item was added: + ----- Method: WeakIdentityDictionary>>removeUnreferencedKeys (in category 'as yet unclassified') ----- + removeUnreferencedKeys + "Make sure tally is set to the right size by #compact." + + super removeUnreferencedKeys. + self compact!
Item was added: + ----- Method: WeakIdentityDictionary>>slowSize (in category 'accessing') ----- + slowSize + "Careful!! Answer the maximum amount + of elements in the receiver, not the + exact amount" + + | count | + count := 0. + 1 to: array size do: [ :index | + (array at: index) ifNotNil: [ :object | + object == vacuum ifFalse: [ + count := count + 1 ] ] ]. + ^count!
packages@lists.squeakfoundation.org