-
-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why SortedCollection sort: and sortBlock: do not uses the same method to sort? #2866
Comments
It seems even more odd than what Marcus describes. The #sort: method is implemented in these collection classes: SequenceableCollection -> uses its own implementation of mergesort Finally, as Marcus noticed, the #sortBlock: of SortedCollection uses a #sort:to: mergesort implemented in SortedCollection. The clue in the sort:to: seems to be that they know they use an array as datastructure, and can use swap and other things. I made some timings of the two algorithms, and it seems like the #sort:to: is a few (2-3) percent faster, so not really an issue. My suggestion is to remove the marginally faster algorithm, and make all build-in sorting be based on the algorithm in SequenceableCollection I tried, and it does not violate any tests. |
It is actually worse than bad. However, because the browser - Calypso - depends so strongly on SortedCollection the Pharo system hangs if I try to change anything in SortedCollection. |
This is more a discussion than an actionable issue. |
from: https://pharo.fogbugz.com/f/cases/17925/Why-SortedCollection-sort-and-sortBlock-do-not-uses-the-same-method-to-sort
sortBlock: uses SortedCollection>>sort:to: algorithm (kind of merge sort) and sort: the mergeSort on Array.
The text was updated successfully, but these errors were encountered: