--- a/SortedCollection.st Fri Jan 30 01:50:42 1998 +0100
+++ b/SortedCollection.st Fri Jan 30 01:57:28 1998 +0100
@@ -53,6 +53,17 @@
while [:a :b | a > b] defines descening order.
The default sortBlock for SortedCollections is the first one.
+ Compatibility Warning:
+ VW seems to use a default sortBlock which compares a<=b,
+ while ST/X uses a<b.
+ That means, that elements which are compared MUST understand #< in ST/X
+ while the minumum protocol is #<= in VW.
+ This may be changed in a future release of ST/X
+ (it is not yet, to not confuse existing applications ...
+ ... be aware, that the sortBlock has an effect on a few algorithms
+ found here; especially #indexForInserting is critical.)
+
+
[author:]
Claus Gittinger
"
@@ -92,35 +103,8 @@
If you already have a big sortedCollection at hand, adding multiple
items may be better done with #addAll:, which resorts all elements, if
the number of added items is more than some threshold number.
- Building some big collection:
-
- |o rnd c|
-
- o := OrderedCollection new.
- rnd := Random new.
- 10000 timesRepeat:[
- o add:rnd next.
- ].
- o := o asSortedCollection.
-
- adding 1000 elements individually to it:
-
- 1000 timesRepeat:[
- o add:rnd next.
- ].
-
- takes 258 ms
- (because the elements have to be shifted around for each added element);
-
- while adding them en-bloque with:
-
- c := OrderedCollection new.
- 1000 timesRepeat:[
- c add:rnd next.
- ].
- o addAll:o
-
- takes 71 ms
+ However, the break-even point where bulk-adding is faster depends
+ on the machine ... (and ST/X version ;-).
"
! !
@@ -705,6 +689,6 @@
!SortedCollection class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/SortedCollection.st,v 1.36 1998-01-30 00:50:42 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SortedCollection.st,v 1.37 1998-01-30 00:57:28 cg Exp $'
! !
SortedCollection initialize!