equal
deleted
inserted
replaced
5732 probable elements towards the beginning of aCollection, to avoid useless searches. |
5732 probable elements towards the beginning of aCollection, to avoid useless searches. |
5733 |
5733 |
5734 Also: I am not sure, if (and if so, at which breakeven), |
5734 Also: I am not sure, if (and if so, at which breakeven), |
5735 it is better to reverse the loops, and walk over the receiver's |
5735 it is better to reverse the loops, and walk over the receiver's |
5736 elements once, walking over the searched elements in the inner loop. |
5736 elements once, walking over the searched elements in the inner loop. |
5737 If the receiver is large, caching effects will definitely favour this. |
5737 If the receiver is large, caching effects will definitely favour this, as |
|
5738 the smaller collection might fit into the cache. |
5738 " |
5739 " |
5739 |
5740 |
5740 |mySize searchedSize| |
5741 |mySize searchedSize| |
5741 |
5742 |
5742 mySize := self size. |
5743 mySize := self size. |
5764 Time millisecondsToRun:[ |
5765 Time millisecondsToRun:[ |
5765 1000000 timesRepeat:[ coll includesAny:#(500 600) ] |
5766 1000000 timesRepeat:[ coll includesAny:#(500 600) ] |
5766 ]. |
5767 ]. |
5767 |
5768 |
5768 |coll| |
5769 |coll| |
|
5770 coll := (1 to:10000). |
|
5771 Time millisecondsToRun:[ |
|
5772 1000000 timesRepeat:[ coll includesAny:#(500 600) ] |
|
5773 ]. |
|
5774 |
|
5775 |coll| |
5769 coll := (1 to:10000) asOrderedCollection. |
5776 coll := (1 to:10000) asOrderedCollection. |
5770 Time millisecondsToRun:[ |
5777 Time millisecondsToRun:[ |
5771 100000 timesRepeat:[ coll includesAny:#(-1 -10) ] |
5778 100000 timesRepeat:[ coll includesAny:#(-1 -10) ] |
5772 ]. |
5779 ]. |
5773 |
5780 |
5786 100000 timesRepeat:[ coll includesAny:'bc' ] |
5793 100000 timesRepeat:[ coll includesAny:'bc' ] |
5787 ]. |
5794 ]. |
5788 |
5795 |
5789 " |
5796 " |
5790 |
5797 |
5791 "Modified (comment): / 30-04-2016 / 17:13:33 / cg" |
5798 "Modified (comment): / 12-02-2017 / 11:47:42 / cg" |
5792 ! |
5799 ! |
5793 |
5800 |
5794 includesAnyIdentical:searchedElementsCollection |
5801 includesAnyIdentical:searchedElementsCollection |
5795 "return true, if the receiver includes any from the argument, aCollection. |
5802 "return true, if the receiver includes any from the argument, aCollection. |
5796 Return false if it includes none. |
5803 Return false if it includes none. |