Because I checked the function source and it appears to use a BUBBLE SORT, the slowest sorting algorithm on the face of the planet!
You should use this instead. It's Mergesort for linked lists:
http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
BubbleSort has a worst case time of O(N^2) and is stable.
Merge sort has a worst case time of O(n log n) and is also stable.
(Stable means two elements with the same value will retain their relative locations in the list.)
Merge sort for linked lists also does not require more than a few extra variables of storage to perform the sort. So it is memory efficient.
See this page for speed comparisons between sorting algorithms:
http://linux.wku.edu/~lamonml/algor/sort/sort.html
Look at how fast Mergesort is there compared to Bubble sort. Bubble takes at least several seconds to sort 1000 objects, whereas Merge sort can sort over 100,000 objects in that same time frame.
Quicksort is the fastest, but much more complicated, and recursive, and performs really slowly on lists that are nearly sorted. I don't see any mention anywhere about Mergesort having those same issues.
[edit]
Aha, busted!
You should use this instead. It's Mergesort for linked lists:
http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
BubbleSort has a worst case time of O(N^2) and is stable.
Merge sort has a worst case time of O(n log n) and is also stable.
(Stable means two elements with the same value will retain their relative locations in the list.)
Merge sort for linked lists also does not require more than a few extra variables of storage to perform the sort. So it is memory efficient.
See this page for speed comparisons between sorting algorithms:
http://linux.wku.edu/~lamonml/algor/sort/sort.html
Look at how fast Mergesort is there compared to Bubble sort. Bubble takes at least several seconds to sort 1000 objects, whereas Merge sort can sort over 100,000 objects in that same time frame.
Quicksort is the fastest, but much more complicated, and recursive, and performs really slowly on lists that are nearly sorted. I don't see any mention anywhere about Mergesort having those same issues.
[edit]
Aha, busted!
ModuleInfo "Author: Mark Sibly"[/edit]