News for hackers. Stuff that matters.
Re:Why is it faster to process a sorted array than an unsort... by redcalx on Friday September 15, 2017 @11:27AM (#15257916)
Yes heuristic logic can have a role here, e.g. if list has length M and number of passes through it M, do N*M and if the result is over some threshold then make the effort of sorting the list. But a good value for that threshold depends on many factors, hence a heuristic may make sense in some scenarios. It's the same sort of pattern used with SQL query optimizers, e.g. cardinality of a result set is one of the key factors that influence how some query on that result set will be executed, e.g. whether to scan versus use an index.

There are no comments on this comment yet.