Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
As shown by the benchmarks for CALCITE-3920, the sort with a TreeMap is slower than sorting with Arrays.sort(Object[]). The latter takes about 35% less time than sorting with TreeMap over a randomized input. While the implementation is not exactly the same, it should be close enough to be able to say something about the performance of EnumerableDefaults.orderBy(...). The relevant results for this issue are the benchmarks with limit=-1 and algorithms treeMap and collectionSort.
The speedup might be even better if the input is already sorted by chance (i.e., it depends on the actual data during the execution and the planner is not aware that the result would be sorted). Modern VMs use TimSort, which checks if the input is already sorted.
Attachments
Attachments
Issue Links
- relates to
-
CALCITE-3920 Improve ORDER BY computation in Enumerable convention by exploiting LIMIT
- Closed