This question came up during a workshop I taught at a large power company:
I want to generate a number of load-duration and price-duration curves, but it takes too long.
Here is a small example demonstrating some formulations for sorting a 1d parameter:
The timings are:
|SUM (assignment to p2)||28.407|
|LOOP (assignment to p3)||22.230|
|TRICK (assignment to p4)||0.265|