Collection.st
changeset 19749 1cde0a794634
parent 19738 8ac31aac9eb6
child 19780 6286d1e4c360
--- a/Collection.st	Sun May 08 02:22:47 2016 +0200
+++ b/Collection.st	Sun May 08 02:26:20 2016 +0200
@@ -5669,7 +5669,7 @@
 !
 
 includesAll:aCollection
-    "return true, if the the receiver includes all elements of
+    "return true, if the receiver includes all elements of
      the argument, aCollection; false if any is missing.
      Notice: this method has OČ runtime behavior and may be
              slow for big receivers/args. 
@@ -5702,7 +5702,12 @@
         If the receiver is large, caching effects will definitely favour this.        
     "
 
-    self size < searchedElementsCollection size ifTrue:[
+    |mySize searchedSize|
+    
+    mySize := self size.
+    searchedSize := searchedElementsCollection size.
+    "/ avoid this only for big receivers, due to caching effects
+    (mySize < searchedSize) ifTrue:[
         self do:[:existingElement |
             (searchedElementsCollection includes:existingElement) ifTrue:[^ true].
         ].
@@ -5722,8 +5727,8 @@
      |coll|
      coll := (1 to:10000) asOrderedCollection.
      Time millisecondsToRun:[
-        100000 timesRepeat:[ coll includesAny:#(500 600) ]
-     ].  
+        1000000 timesRepeat:[ coll includesAny:#(500 600) ]
+     ]. 
 
      |coll|
      coll := (1 to:10000) asOrderedCollection.