| Cloned from HHH-12374 Resolved to cover the use of Bubble Sort. As noted there, this can be fixed by just making the following 1-line change in ActionQueue.java – change the inner for loop
for ( int j = i + 1; j < latestBatches.size(); j++ ) {
on line 1210 to instead iterate backwards:
for ( int j = latestBatches.size() - 1; j > i ; j-- ) {
This causes the swaps that the sort code it finds to prioritizeto be long-distance rather than short-distance moves, which makes the sorting much faster. Theoretically I would expect it to improve from a wort-case behavior O(N^3) to O(N^2) in the number of tables. In practice on the attached fuzz test I see an even larger improvement, from >200,000 iterations wort case found to <40 iterations. |