<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>> <span style="font-size:12pt">OrderedDictionary changes:</span></p>
<div>> - make it a subclass of PluggableDictionary. This lets one create e.g. an ordered identity dictionary without creating a subclass with duplicated behavior</div>
<div><br>
</div>
<div>Just a stupid question: Why do we have separate Pluggable/IdentityDictionary subclasses of Dictionary at all and did not directly implement Dictionary with a pluggable block? Is this a historic decision or an optimization thing? :-)</div>
<div><br>
</div>
<div>Best,</div>
<div>Christoph</div>
<p></p>
<div id="x_Signature">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="x_divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von commits@source.squeak.org <commits@source.squeak.org><br>
<b>Gesendet:</b> Montag, 5. Oktober 2020 00:31:44<br>
<b>An:</b> squeak-dev@lists.squeakfoundation.org; packages@lists.squeakfoundation.org<br>
<b>Betreff:</b> [squeak-dev] The Trunk: Collections-ul.915.mcz</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Levente Uzonyi uploaded a new version of Collections to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Collections-ul.915.mcz">http://source.squeak.org/trunk/Collections-ul.915.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Collections-ul.915<br>
Author: ul<br>
Time: 5 October 2020, 12:30:33.597525 am<br>
UUID: 93341c2a-ebb2-4d2b-abee-e3f42f509836<br>
Ancestors: Collections-eem.913<br>
<br>
HashedCollection changes:<br>
- make #capacity return the actual capacity of the collection instead of the size of the internal array. This change is obviously not backwards compatible.<br>
- improve the performance of #isEmpty when tally is 0<br>
<br>
OrderedDictionary changes:<br>
- make it a subclass of PluggableDictionary. This lets one create e.g. an ordered identity dictionary without creating a subclass with duplicated behavior<br>
- simplify #initialize and #growTo: now that #capacity is accurate<br>
<br>
=============== Diff against Collections-eem.913 ===============<br>
<br>
Item was changed:<br>
  ----- Method: HashedCollection>>capacity (in category 'accessing') -----<br>
  capacity<br>
+        "Answer the current capacity of the receiver - aka the number of elements the receiver can hold without growing."<br>
-        "Answer the current capacity of the receiver."<br>
  <br>
+        ^ array size * 3 // 4!<br>
-        ^ array size!<br>
<br>
Item was changed:<br>
  ----- Method: HashedCollection>>isEmpty (in category 'testing') -----<br>
  isEmpty<br>
         "For non-weak collections, we can use the tally to speed up the empty check. For weak collections, we must use the traditional way because the tally is unreliable. Also see #size vs. #slowSize."<br>
  <br>
+        tally = 0 ifTrue: [ ^true ].<br>
+        ^array class isWeak and: [ super isEmpty ]!<br>
-        ^ array class isWeak<br>
-                ifFalse: [ tally = 0 ]<br>
-                ifTrue: [ super isEmpty ]!<br>
<br>
Item was changed:<br>
  ----- Method: HashedCollection>>removeAll (in category 'removing') -----<br>
  removeAll<br>
         "remove all elements from this collection.<br>
         Preserve the capacity"<br>
         <br>
+        self initialize: array size!<br>
-        self initialize: self capacity!<br>
<br>
Item was changed:<br>
+ PluggableDictionary subclass: #OrderedDictionary<br>
- Dictionary subclass: #OrderedDictionary<br>
         instanceVariableNames: 'order'<br>
         classVariableNames: ''<br>
         poolDictionaries: ''<br>
         category: 'Collections-Sequenceable'!<br>
  <br>
  !OrderedDictionary commentStamp: 'mt 1/16/2015 10:42' prior: 0!<br>
  I am an ordered dictionary. I have an additional index (called 'order') to keep track of the insertion order of my associations.<br>
  <br>
  The read access is not affected by the additional index.<br>
  <br>
  The index is updated in O(1) [time] when inserting new keys. For present keys, that insertion involves actions in O(n) to move the respective element to the end of the order.<br>
  <br>
  The growth operation compacts the index and takes O(n) additional time.<br>
  <br>
  NOTE: This is still no instance of SequenceableCollection. Having this, some protocols are missing and may require working on #associations, which is an Array and thus sequenceable.!<br>
<br>
Item was changed:<br>
  ----- Method: OrderedDictionary>>growTo: (in category 'private') -----<br>
  growTo: anInteger<br>
  <br>
-        | oldOrder |<br>
         super growTo: anInteger.<br>
+        order := order grownBy: self capacity - order size!<br>
-        oldOrder := order.<br>
-        "Grow only to 75%. See #atNewIndex:put: in HashedCollection."<br>
-        order := self arrayType new: anInteger + 1 * 3 // 4.<br>
-        order<br>
-                replaceFrom: 1<br>
-                to: tally<br>
-                with: oldOrder<br>
-                startingAt: 1!<br>
<br>
Item was changed:<br>
  ----- Method: OrderedDictionary>>initialize: (in category 'private') -----<br>
  initialize: n<br>
  <br>
         super initialize: n.<br>
+        order := self arrayType new: self capacity!<br>
-        order := self arrayType new: n + 1 * 3 // 4!<br>
<br>
<br>
</div>
</span></font>
</body>
</html>