A lot would depend on how the sorting is being done. We have seen applications that internally build an array of string then use a simple bubble sort to sort the data. While this is fine for a few hundred entries, when dealing with thousands of entries these can take a long time.
For example the SRT function provided by PxPlus does a basic bubble sort which can take a long time if sorting a lot of entries.
If sorting a lot of entries we suggest instead of using the SRT function that they use a memory file (*MEMORY*) to perform the sort. You can see the difference if you run the code below:
for i=1 to 20000
print "x$ Built..."
wait 0 ! Flush output
x=tmr(0) ! Reset timer
print "SRT function took ",tmr(0)," seconds"
for v$ from x$
print "Memory file took ",tmr(0)," seconds"
If you run this you will see a significant difference in the time to sort the values.
For example, on my system the SRT took just under 2 seconds; but to build the memory file the system only took 0.018 seconds.
While that's not bad to sort 20,000 values, if you increase the number of elements (change the FOR loop to 100000) you will see an exponential increase in the SRT time. On my system the 2 seconds went to 58 seconds, far more than the 5 fold increase on the number of elements. The memory file however only increased to .138 seconds -- much closer to the actual increase in the record count.
Now it should be mentioned that using either the SRT or a MEMORY file does not involve any disc activity so if your sort took 25 minutes and was memory resident a mapped drive could easily get disconnected due to inactivity.