#DOCUMENTATION by cg
class: Collection
comment/format in: #includesAll:
changed: #includesAny:
--- 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.