3 ms·
I pointed it out to be lighthearted, but it's true not sarcasm, and not only true, it's also meaningfully instructive to think about the benefits of lazy evalua
by brashrat 11y ago
I pointed it out to be lighthearted, but it's true not sarcasm, and not only true, it's also meaningfully instructive to think about the benefits of lazy evaluation.
For example, a priority queue (list of tasks) does not need to be fully sorted, only sorted to the extent that the highest priorty item is quickly determinable, and there are algorithms and data structures designed for this behavior.
Sorting (other than to print a sorted list) doesn't pay for itself till you do a number of searches, and associative memory hashes are frequently better if you simply wish to find exact matches again. Even the lowly bubble sort has the not-insignificant benefit of finding the first value in O(n) time which may be the behavior you need: lazy evaluation can be the exact right way to go if you are instructed to sort, as you await more info as to what the appropriate technique might be.
I think humor is only funny when it's based on truthiness.
- dekhn 11y agoThis is an out-of-core problem. What matters when sorting a billion numbers is wallclock runtime from the start of the sort to the end of materialization (see http://sortbenchmark.org/ http://sortbenchmark.org/) or iteration. And it means, almost always, materializing or iterating the entire result set. it's not clear to me any haskell programs have won any real awards in sorting modest amounts of data, since you have to visit all the data and compare nlogn times.
- GFK_of_xmaspast 11y ago> Sorting (other than to print a sorted list) doesn't pay for itself till you do a number of searches Or until you absolutely need to iterate thru a collection in sorted order. If you need a priority queue, use a priority queue, if you need a sorted container, use a sorted container.