* Cecil Westerhof <Cecil@decebal.nl>
| I use:
| return [lsort -decreasing -index 0 ${history}]
| to return it sorted decreasing on the first element of the containing
| lists.
| It seems that when the sort is not necessary that the sort does not
| take much time. Can I count on this, or could it be that it is not
| always the case and is it better to add code to make sure it is only
| sorted when it is necessary?
man lsort(n)
The implementation of the lsort command uses the merge-sort
algorithm which is a stable sort that has O(n log n) performance
characteristics.
I read that merge-sort on an almost sorted list has good performance.
So as long as the algorithm of lsort is not changed...
But.
How much time max is it allowed to take before sorting becomes
noticeable? 1 second? 1 millisecond?
A history list sounds useful only if it does *not* contain zillions of entries, and for anything less than say some hundred entries the time
for sorting it once should not be noticeable.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 463 |
Nodes: | 16 (2 / 14) |
Uptime: | 156:54:22 |
Calls: | 9,384 |
Calls today: | 4 |
Files: | 13,561 |
Messages: | 6,095,919 |