[Pharo-project] Revisiting Issue 1718

2010-11-19 Thread Stephan Eggermont
I would be interested in improvements. This is just a straight translation of the java code. Yaroslavskiy's Dual-Pivot Quicksort seems to perform better for large collections: A straightforward defaultSort: i to: j self dualPivotQuicksort: i to: j split: 3 dualPivotQuicksort: left to:

Re: [Pharo-project] Revisiting Issue 1718

2010-11-19 Thread Levente Uzonyi
For 1718: - don't use #asSortedCollection for sorting. - SortedCollection uses quicksort, not merge sort as stated in a comment. That's why #asSortedCollection is slow when there are only a few different values. Quicksort performance degrades to O(n^2) in this case, but that's totally valid.