try to avoid allocation of a new keyArray in #setTally:
authorClaus Gittinger <cg@exept.de>
Wed, 05 Aug 1998 10:47:57 +0200
changeset 3726 cf3eafa152a4
parent 3725 b50bfa6fdbca
child 3727 2b05022de748
try to avoid allocation of a new keyArray in #setTally: (invoked via #removeAll)
Set.st
--- a/Set.st	Tue Aug 04 02:01:49 1998 +0200
+++ b/Set.st	Wed Aug 05 10:47:57 1998 +0200
@@ -656,8 +656,17 @@
      and set tally to zero.
      The size is increased to the next prime for better hashing behavior."
 
-    keyArray := self keyContainerOfSize:(self class goodSizeFrom:count). 
+    |n|
+
+    n := self class goodSizeFrom:count.
+    n == keyArray size ifTrue:[
+        keyArray atAllPut:nil.
+    ] ifFalse:[
+        keyArray := self keyContainerOfSize:n. 
+    ].
     tally := 0
+
+    "Modified: / 4.8.1998 / 22:07:25 / cg"
 ! !
 
 !Set methodsFor:'private - grow & shrink'!
@@ -784,6 +793,6 @@
 !Set class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.56 1998-02-03 13:34:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.57 1998-08-05 08:47:57 cg Exp $'
 ! !
 Set initialize!