Fix in SmallSense::Manager: sample at most 100 instances...
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 01 Oct 2013 09:38:56 +0100
changeset 111 2d880f47cfff
parent 110 5ee9a90dbed5
child 112 5c8f0eb0dd55
Fix in SmallSense::Manager: sample at most 100 instances... ...because for some classes it may take some time to investigate all instances (think of Method, Array...)
SmallSense__Manager.st
--- a/SmallSense__Manager.st	Mon Sep 30 14:19:24 2013 +0100
+++ b/SmallSense__Manager.st	Tue Oct 01 09:38:56 2013 +0100
@@ -165,26 +165,29 @@
 
 delayedUpdateInfoForClass: class
 
-    | superclass info instVarNames instVarTypes |
+    | superclass info instVarNames instVarTypes nprobed |
 
     superclass := class superclass.
     superclass notNil ifTrue:[self updateInfoForClass: superclass].
     info := self infoForClass: class.
     instVarNames := class allInstVarNames.
     instVarTypes := instVarNames collect: [:instvar | info infoForInstvar: instvar ]. 
+    class methodsDo:[:mthd|updater add:mthd].
 
+    nprobed := 0.
     class allInstancesDo: [:instance |
-        1 to: instVarNames size do:[:i|
-            | instVarType |
-
-            instVarType := instVarTypes at:i.
+        instVarTypes withIndexDo: [:instVarType :i | 
             instVarType union: ((Type withClass: (instance instVarAt: i) class) type trustfullness: 70). 
         ].
+        nprobed := nprobed + 1.
+        nprobed > 100 ifTrue:[
+            "/ Probe at most 100 instancess
+            ^ self
+        ].
     ].
-    class methodsDo:[:mthd|updater add:mthd].
 
     "Created: / 27-11-2011 / 18:04:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 24-09-2013 / 13:38:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-10-2013 / 07:22:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 delayedUpdateInfoForClassOrMethod: classOrMethod